Modular Abilities

Switch statement to optimize the various conditions

It’s fairly straight forward, we enable different powerups based on the ID of the power up. 0 is for the Triple Shot, 1 is for the Speed Up, and 2 is for the Shield. Now, I don’t like the default way this is done, so I’m going to convert it into an enumeration and case against that within the switch. Which means I’m going to go ahead and rename powerupID to PowerUpType and convert it from an int to an enum PowerUpType.

This shows up nicely in the editor, too!
Proper Drop Down
Enumeration values based on capital letters for spaces
A much cleaner and clearer switch statement!

And afterwards, we just have to update our Spawn Manager to be able to handle multiple powerups’ prefabs, as well as randomly select which powerup to spawn.

Change it from the triple shot powerup prefab to an array (more efficient if known length) or list of prefabs
Setup the prefabs for each powerup
For now, restricted to the two abilities. Randomly timed spawns, randomly typed powerups.

--

--