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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.