7
Weapon Systems
To be as flexible as possible, in this chapter we 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.
The weapon controller deals with weapons and passes on messages to them. It contains an array containing all weapons and a method to activate and deactivate them as required.
Each weapon is a prefab with a script attached that derives from BaseWeaponScript.cs. The weapon should be self-contained other than when it receives ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access