using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Unity.VisualScripting; using UnityEngine; public class GameManager : MonoBehaviour { [SerializeField] public float Timescale { set { Time.timeScale = value; } } [SerializeField] private GameObject CrystalRef; public static GameObject Crystal; public static bool IsPaused { get; private set; } [SerializeField] private GameObject pauseMenuUI; private void Awake() { Crystal = CrystalRef; } void Update() { if (Input.GetKeyDown(KeyCode.Escape)) TogglePause(); } public void TogglePause() { IsPaused = !IsPaused; Time.timeScale = IsPaused ? 0f : 1f; AudioListener.pause = IsPaused; pauseMenuUI.SetActive(IsPaused); } }