Single Fire Button and Non-Active Weapon Powerups

I have a working blaster for my space shooter game and also have a simple powerup system for it that just changes the instantiated bullets when picked up. This works fine so far. However, I have a bomb and missile powerup which will also be fired by the same button from two different fire points. Since you start with just a blaster how do I go about dealing with those two fire points doing nothing every time I press fire?

It looks like its bad practice to return null values in C#. Do I have to remake my system where the weapon powerups are child objects of the player and then set them to false from the start then just make whatever I want active through the powerups? Any other options?

So have you got 2 sets of buttons for the different weapons?

Hi, I actually figured this all out. No, I have 1 button for multiple weapon types. I created an empty object names Lasers, then made my 3 test child objects being Red, Green, and Purple lasers each with a fire point. Then, disabled all of them on start and the powerup just activates one and deactivates the others. Repeat the same for the Bomb and Missle powerups. Works pretty well.

1 Like