// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { Debug.Log("Exiting game"); #if UNITY_EDITOR UnityEditor.EditorApplication.isPlaying = false; #else Application.Quit(); #endif } if (Input.GetKeyDown(KeyCode.R)) { SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); } if (unityChan.IsDead()) { text1.text = "You died"; text2.text = "Press R to restart. Press Esc to exit the game."; } if (levelPassed) { Time.timeScale = 0; unityChan.Invulnerable = true; text1.text = "Level completed!"; } }
public bool IsDead() { return(unitHealth && unitHealth.IsDead()); }