aboutsummaryrefslogtreecommitdiffstats
path: root/Assets/Scripts/PauseMenu.cs
blob: ba246c48b2df6872c93adec8f181e12957b4ee3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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;
    }
}