예제 #1
0
    public void TogglePauseMenu()
    {
        if (pauseMenu)
        {
            pauseMenu.DestroySelf();
        }
        else if (canvas)
        {
            Time.timeScale = 0.0f;
            var pauseMenuObject = GameObject.Instantiate(ResourceManager.GetUIElement("PauseMenu"));
            pauseMenu = pauseMenuObject.GetComponent <PauseMenu>();

            pauseMenu.transform.SetParent(canvas.transform, false);

            var loadButton = pauseMenu.GetComponentInChildren <LoadButton>();
            loadButton.relatedSceneName = SceneManager.GetActiveScene().name;
        }
    }
예제 #2
0
 private void Awake()
 {
     _deathMenu = GameObject.Find("Canvas").GetComponent <Menu.PauseMenu>();
     _health    = MaxHealth;
 }