Chapter 6

Weapon Systems

The weapon system, or more specifically at this point, the firing system, needs to be capable of dealing with either single or multiple weapons. To be as flexible as possible, we will build a weapon management system that will control individual weapon controllers. Those weapon controllers, in turn, will deal with spawning projectiles, and finally, projectiles will take care of themselves independently. Our weapon management system should function with a single weapon, or we should be able to add many different weapons and switch between them.

Our parent system should work independently of each specific weapon and fire out a generic message to the currently selected one. The selected weapon will deal with the call itself, ...

Get C# Game Programming Cookbook for Unity 3D now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.