public void Reward(Collider other) { _gameController.setCollectible(true); if (other.gameObject.name.Contains("Restore Health")) { _gameController.RestoreHealth(); _gameController.setCollectible(false); } if (other.gameObject.name.Contains("Protection")) { if (countdown != null) { StopCoroutine(countdown); } _gameController.setProtection(true); countdown = StartCoroutine(timer.Countdown("Protection")); } if (other.gameObject.name.Contains("KillAll")) { if (countdown != null) { StopCoroutine(countdown); } _gameController.setKillAll(true); countdown = StartCoroutine(timer.Countdown("KillAll")); } if (other.gameObject.name.Contains("Passable")) { if (countdown != null) { StopCoroutine(countdown); } _gameController.setPlayerCollider(false); countdown = StartCoroutine(timer.Countdown("Passable")); } Destroy(other.gameObject); }
public void StartStopCountdown(bool start, bool resetOnStart = false) { if (countdownRoutine != null) { StopCoroutine(countdownRoutine); countdownRoutine = null; } if (start) { if (resetOnStart) { gameTime.Reset(); } countdownRoutine = StartCoroutine(gameTime.Countdown()); } }