Road TO Dev — Setting up player to fire Tripleshot!
Ok so now that we have a visual for our powerup and because we copied the laser prefab it has movement let’s setup our player to use it. First we need to tell the player what the game object is even and attach the prefab to our player.
Now we need to tell our player to instantiate this game object instead of our regular laser but only when we collide with the powerup. We already setup some of this logic so that when the powerup collides we trigger TripleShotActive. So now we just need to setup our Fire() to use it.
First we need to setup our powerup script to communicate properly and because we have a tag associated with the player already in the collision we can utilize that. Don’t forget to null check.
Now let’s have our player react to the triple shot being active!
Also in our tripleshot prefab we need to remove the laser script from the children. Only the parent needs it just make sure they all have the tag Laser still.
Now let’s test it out!