Switch Statements (Game Dev Day 20)
As briefly shown in my previous article, switch statements can be used in Unity for scripts that need to have multiple possible outcomes.
Instead of having 3 unique scripts (one of each of our powerups) we can just reference the appropriate coroutine on our Player script based on the value assigned here at the switch command. If we made another power up that made the player shoot 10 lasers, we could just add another option to the switch command (and create the appropriate coroutine in the Player script.
If you are making a system that needs multiple outcomes for the same action, you can also use a switch statement and use a random integer (or integer range) for the applicable coroutines.