using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; public enum UnlockedItems { None, Trumpet, Tambourine, Clarinet, Cymbal, } public class StateController : MonoBehaviour { // Singleton class public static StateController Instance = null; [Header("Respawning")] [SerializeField] GameObject player; public GameObject spawnPoint; [SerializeField] private GameObject deathCanvas; [Header("Pause Menu")] public bool isPaused = false; public GameObject pauseMenuCanvas; [Header("Debug")] public bool inDebugMode; public GameObject debugCanvas; [Header("Enemies")] GameObject[] enemiesInScene; [Header("Level Progression")] GameObject victoryCanvas; [Header("Unlocked Items")] public UnlockedItems itemProgression = UnlockedItems.None; public bool projectileInRange = false; void Awake() { if (Instance == null) { Instance = this; } else { Destroy(this.gameObject); return; } DontDestroyOnLoad(this.gameObject); SceneManager.sceneLoaded += OnSceneLoaded; } void Start() { if (this.inDebugMode) { debugCanvas = GameObject.Find("DebugCanvas"); debugCanvas.SetActive(false); } } public bool HasTrumpet() { return this.itemProgression >= UnlockedItems.Trumpet; } public bool HasTambourine() { return this.itemProgression >= UnlockedItems.Tambourine; } public bool HasClarinet() { return this.itemProgression >= UnlockedItems.Clarinet; } public bool HasCymbal() { return this.itemProgression >= UnlockedItems.Cymbal; } void OnSceneLoaded(Scene scene, LoadSceneMode mode) { #region FIND OBJECTS deathCanvas = GameObject.Find("DeathUICanvas"); if (deathCanvas != null) { Button respawnButton = GameObject.Find("RespawnButton").GetComponent