Determining How Long Powerup Effects Should Last..
PowerUp Effects — Plays important role..and how long player should have that depends on the use case based on the Game Scenario.
Consider for our Galaxy Shooter 2D- for Triple-Shot Power-up, when player collect this power-up..he started shooting..three shots of lasers and this triple — shots of laser lasts for couple of seconds say 5 sec before it turns into original.
Design & logical mechanics for this PowerUp effects as under..
Here we have Power-Up Prefabs and for these prefabs we have Power-Up Scripts attached with respective _powerupID ref variable. Now when Player collect Triple-Shot , it happens during OnTriggerEnter2D event in PowerUp Script — It calls the player.TripleShotActive() method.
Now in Player Script.. when TripleShotActive() method is called, it set boolean variable set to true and calls the coroutine -TripleShotPowerDownRoutine()
So, when it sets _isTripleShotActive to true , it starts instantiating TripleShotLaser prefab i.e, three lasers in one shot unless it again sets to false after 5 sec..then start instantiating one laser.. .
This is how long PowerUp Effects last…based on the choice of Game Scenario ..
@GameDevHQ-Day 17…