public IEnumerator DIE() { if (bonus == false) { health = health - 1; ScoreKeeper.livesLeft = health; Power_up.power_type = 0; } if (health >= 1) { if (!gameObject.name.Contains("BonusExit")) { SoundFXScript.playDeathSound(); yield return(new WaitForSeconds(3)); } ScoreKeeper.resetTimer(); Application.LoadLevel(respawn); yield return(null); } if (health <= 0) { yield return(new WaitForSeconds(3)); LoadLevelScript.loadNewGame(); Application.LoadLevel(DEAD); yield return(null); } }
// Update is called once per frame void Update() { // Reload same level if (Input.GetKeyDown(KeyCode.R)) { LoadLevelScript.LoadSameLevel(); } // Reload next level, or back to initial level if (Input.GetKeyDown(KeyCode.N)) { LoadLevelScript.LoadNextLevel(); } // on WIN conditions if (winLevel == true) { if (winLevel == true && displayMessage == true) { Debug.Log("<color=red>You win!!! Want to continue ? (y)</color>"); Time.timeScale = 0.3f; displayMessage = false; } // Continue to next level if (Input.GetKeyDown(KeyCode.Y)) { LoadLevelScript.LoadNextLevel(); Time.timeScale = 1; winLevel = false; displayMessage = true; } } }