Getting down with picking up power-ups
Last time, I created the powerup functionality for the player but that’s worthless if I don’t actually have a powerup spawning on the map to be picked up. I’ll add another coroutine to the SpawnManager script to instantiate a new instance of a collectible powerup and wait for a random time between 3 and 7 seconds. I might increase this time later, as it seems like powerups are spawning too frequently.
The logic already exists for the player to pickup the powerup, but I only want the player to have triple-shot for a few seconds at a time. You know what that means: Another coroutine! This one is in the player script.
EnableTripleShot() is being called from the Powerup script when the player collides with the powerup. Here it is in action.