24 lines
549 B
C#
24 lines
549 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using UnityEngine;
|
|
|
|
public class SpawnManager : MonoBehaviour {
|
|
public static bool IsPaused { get; private set; }
|
|
[SerializeField] private GameObject pauseMenuUI;
|
|
|
|
void Update() {
|
|
if (Input.GetKeyDown(KeyCode.Escape))
|
|
TogglePause();
|
|
}
|
|
|
|
public void TogglePause() {
|
|
IsPaused = !IsPaused;
|
|
Time.timeScale = IsPaused ? 0f : 1f;
|
|
AudioListener.pause = IsPaused;
|
|
pauseMenuUI.SetActive(IsPaused);
|
|
}
|
|
}
|