public void RoverDied() { isDead = true; rover.Disable(); GetComponent <DayNightCyle>().Disable(); GetComponent <AlienSpawner>().Disable(); GetComponent <ResearchMaterialSpawner>().Disable(); GetComponent <LandingPodSpawner>().Disable(); Cursor.visible = true; Cursor.lockState = CursorLockMode.Confined; //hide all UI foreach (Transform child in mainCanvas.transform) { child.gameObject.SetActive(false); } //Setup endgame UI if (health <= 0) { causeOfDeathText.text = "The rover was destroyed."; } else { causeOfDeathText.text = "The rover ran out of energy."; } missionReportText.text = String.Format("The mission lasted {0} days.", GetComponent <DayNightCyle>().currentDay); //set score AppManager appManager = FindObjectOfType <AppManager>(); if (appManager != null) { appManager.SetHighScore(GetComponent <DayNightCyle>().currentDay); } highScoreText.text = String.Format("High Score: {0}", appManager.GetHighScore()); //show endgame UI endGameObject.SetActive(true); }