using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; public enum UnlockedItems { None, Trumpet, Tambourine, Clarinet, } 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; void Awake() { // TODO: Remove this when done AudioListener.pause = true; if (Instance == null) { Instance = this; } //DontDestroyOnLoad(this.gameObject); SceneManager.sceneLoaded += OnSceneLoaded; 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; } void OnSceneLoaded(Scene scene, LoadSceneMode mode) { #region FIND OBJECTS deathCanvas = GameObject.Find("DeathUICanvas"); if (deathCanvas != null) { Button respawnButton = GameObject.Find("RespawnButton").GetComponent