IEnumerator ActivatePowerUp(Utils.PowerUpTypes powerUpType) { float duration = GetPowerUpDuration(powerUpType); yield return(new WaitForSeconds(duration)); SwitchOff(powerUpType); }
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); } }
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); }
public void EnablePowerUp(Utils.PowerUpTypes powerUpType) { SwitchOn(powerUpType); StartCoroutine(ActivatePowerUp(powerUpType)); }