Now that I have added power-ups for the Player to collect, it is time to figure out how long it should last. To do this I first create a variable to assign the time and add the serialize field attribute so I can adjust in the inspector during testing.
Each game will be different as to how you how long the powerup should last. The best thing to do is start with a number and play the game to see what is a good fit. With my space shooter game, I have determined 5 seconds is a good cool down time.
To implement the cooldown for the power-up, I will use a coroutine. the implementation looks as follows