public static void GameOver() { // Destroy all Enemies Enemy.DestroyAllEnemies(); //Destroy Player health/armour bars and the Player object Destroy(Player.PlayerBars); Destroy(player.gameObject); //set the isPlaying bool to false as the player is no longer playing instance.isPlaying = false; // set the size (Field of View/Zoom) of the camera back to 50 instance.gameCamera.orthographicSize = 50f; // Set the Camera back to its default position CameraController.SetCameraPosition(new Vector3(88.7f, 54.6f, -131.8168f)); // Update Leaderboard //check if the score obtained by the user is worthy of the leaderboard bool isScoreToGoOnLeaderboard = leaderboard.CompareScore(score); // show game over canvas instance.GameOverCanvas.SetActive(true); // show the game over canvas instance.GameOverCanvas.transform.GetChild(5).gameObject.SetActive(false); // hide the error message that gets displayed to the user when they try to enter an empty string as a name if (isScoreToGoOnLeaderboard) // if the score is worthy of the leaderboard { // set the cursor to be the navigation cursor CursorController.instance.SetToNavigationCursor(); // set the mouse cursor to be the navigation cursor // show input Name object instance.GameOverCanvas.transform.GetChild(2).gameObject.SetActive(true); // hide better luck next time text instance.GameOverCanvas.transform.GetChild(3).gameObject.SetActive(false); } else { // hide input name object instance.GameOverCanvas.transform.GetChild(2).gameObject.SetActive(false); instance.GameOverCanvas.transform.GetChild(4).gameObject.SetActive(false); // hide congratulations // show leaderboard instance.ShowLeaderBoard(); //show game over text and better luck next time instance.LeaderboardCanvas.transform.GetChild(1).gameObject.SetActive(true); // show game over instance.LeaderboardCanvas.transform.GetChild(2).gameObject.SetActive(true); // show better luck next time instance.LeaderboardCanvas.transform.GetChild(3).gameObject.SetActive(false); // hide congratulations instance.LeaderboardCanvas.transform.GetChild(4).gameObject.SetActive(false); // hide "Be the first to make the leaderboard" } }