// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { pause(pauseMenu); } if (Settings.health <= 0) { if (!gameOver.activeSelf) { gameOver.SetActive(true); if (score.getDistance() > score.getOldDistance()) { PlayerPrefs.SetInt("Player_Distance", score.getDistance()); PlayerPrefs.Save(); } score.stopScore(); state = GameState.EXIT; Settings.gamestate = state; sceneFade.startSceneFade(); } } if (isExiting) { if (!endGame.activeSelf) { endGame.SetActive(true); Debug.Log("isExiting"); score.stopScore(); state = GameState.EXIT; Settings.gamestate = state; sceneFade.startSceneFade(1.1f); } } }