Triple-shot Power Up

Objective: create a triple-shot powerup that lasts for 5 seconds

It’s actually pretty straightforward. For my player, I wanted to create a int check where if the weapon type is 0, it should shoot a single laser. If it’s 1, then shoot a triple-shot (simple prefab). Both prefabs are added into the player inspector — they swap when necessary.

I added in this powerup object. Similar to the enemy, it has a trigger around it. When the player runs over it, it runs a function in the player script that changes the int of what type of weapon from 0 to 1. This initializes the powerup. It also destroys the power-up once collected.

Finally, I created a coroutine on the player that resets the powerup after 5 seconds to the main weapon which is int 0