using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class EndGame : MonoBehaviour { public endDoorCollision endDoor3; public GameObject endGameUI; // Assign this in the inspector to your UI public string targetTag = "endDoor"; // The tag of the object the player will collide with to trigger the menu void Update() { if (endDoor3.endGameDoor == true) { ActivateEndGameMenu(); } } void ActivateEndGameMenu() { endGameUI.SetActive(true); Time.timeScale = 0f; // Pause the game } public void Restart() { Time.timeScale = 1f; // Unpause the game SceneManager.LoadScene("MainScene"); endGameUI.SetActive(false); } public void LoadMenu() { Time.timeScale = 1f; SceneManager.LoadScene("Menu"); } public void QuitGame() { Debug.Log("Quitting Game"); Application.Quit(); } }