diff options
Diffstat (limited to 'Assets/Scripts/PauseMenu.cs')
-rw-r--r-- | Assets/Scripts/PauseMenu.cs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Assets/Scripts/PauseMenu.cs b/Assets/Scripts/PauseMenu.cs new file mode 100644 index 0000000..ba246c4 --- /dev/null +++ b/Assets/Scripts/PauseMenu.cs @@ -0,0 +1,31 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class PauseMenu : MonoBehaviour +{ + [SerializeField] private GameObject pauseMenuUI; + + private static GameObject _pauseMenuUI; + + public static bool isPaused; + + private void Awake() + { + _pauseMenuUI = pauseMenuUI; + } + + public static void Resume() + { + _pauseMenuUI.SetActive(false); + Time.timeScale = 1f; + isPaused = false; + } + + public static void Pause() + { + _pauseMenuUI.SetActive(true); + Time.timeScale = 0f; + isPaused = true; + } +} |