Ejemplo n.º 1
0
    IEnumerator ActivatePowerUp(Utils.PowerUpTypes powerUpType)
    {
        float duration = GetPowerUpDuration(powerUpType);

        yield return(new WaitForSeconds(duration));

        SwitchOff(powerUpType);
    }
Ejemplo n.º 2
0
 private void SwitchOff(Utils.PowerUpTypes powerUpType)
 {
     if (powerUpType == Utils.PowerUpTypes.TripleShot)
     {
         _isTripleShotEnabled = false;
     }
     else if (powerUpType == Utils.PowerUpTypes.Speed)
     {
         _isSpeedPowerUpEnabled = false;
     }
     else if (powerUpType == Utils.PowerUpTypes.Shields)
     {
         _isShieldPowerUpEnabled = false;
         SwitchShieldVisual(false);
     }
 }
Ejemplo n.º 3
0
    private float GetPowerUpDuration(Utils.PowerUpTypes powerUpType)
    {
        float duration = 0f;

        switch (powerUpType)
        {
        case Utils.PowerUpTypes.TripleShot:
            duration = _tripleShotDuration;
            break;

        case Utils.PowerUpTypes.Speed:
            duration = _speedPowerUpDuration;
            break;

        case Utils.PowerUpTypes.Shields:
            duration = _shieldPowerUpDuration;
            break;
        }

        return(duration);
    }
Ejemplo n.º 4
0
 public void EnablePowerUp(Utils.PowerUpTypes powerUpType)
 {
     SwitchOn(powerUpType);
     StartCoroutine(ActivatePowerUp(powerUpType));
 }