public void ResetPowerups() { if (powerupTimers.Count > 0) { // loop through and undo the powerups for (int i = 0; i < powerupTimers.Count;) { PowerupTimer timer = powerupTimers[i]; switch (timer.GetPower()) { case Powerup.PowerupType.DoublePoints: scoreManager.MultiplyScoreMultiplier(0.5f); break; case Powerup.PowerupType.SafeMode: safeMode = false; break; default: break; } } //powerupTimers.Clear(); } }
// Run all powerup timers down void Update() { if (powerupTimers.Count > 0) { for (int i = 0; i < powerupTimers.Count;) { PowerupTimer timer = powerupTimers[i]; timer.SetTimer(timer.GetTimer() - Time.deltaTime); if (timer.GetTimer() <= 0) { powerupTimers.Remove(timer); DeactivatePowerup(timer.GetPower()); } else { i += 1; } } } }