TowerDefenseGame/Assets/Scripts/Runtime/GameManagement/GameManager.cs
Nico 0ef60e5828 Add third party plugin NavMeshPlus
Add A* pathing to enemies
Add choice between havving Goblers chase player as priority or go to crystal
2025-07-09 19:14:28 -07:00

34 lines
722 B
C#

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] 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);
}
}