Determining How Long Powerup Effects Should Last

by Lance Gold
Return to index

A Powerup is a few seconds of gameplay with added something helpful.

Player and Triple Shot

Player and Triple Shot

Here the Player gets a triple shot bonus for five seconds.


public class Player : MonoBehaviour
{
    private bool _isTripleShotActive = false;

    [SerializeField]
    private float _canTripleFireTimeWindow = 5.0f;

    public void TripleShotActive()
    {
        _isTripleShotActive = true;
        StartCoroutine(TripleShotPowerDownRoutine(_canTripleFireTimeWindow));
    }
    IEnumerator TripleShotPowerDownRoutine(float _TripleFireRemainingTime)
    {
        yield return new WaitForSeconds( _TripleFireRemainingTime );
        _isTripleShotActive = false;
    }
}

My answer to the “how long?” question: “keep the player interested in the game.”

Of course (a) keep gamer’s player object alive; (b) keep the game going with enemy objects.

So…

Destroying all the enemy objects is probably the maximum time, then create some new ones to keep the game going.