player can only access items in correct scenes

This commit is contained in:
Sam
2023-05-01 01:52:42 -07:00
parent d3893d3f0e
commit 932af31dc9
12 changed files with 406 additions and 22 deletions

View File

@@ -22,9 +22,14 @@ public class StateController : MonoBehaviour {
[Header("Enemies")]
GameObject[] enemiesInScene;
[Header("LevelProgression")]
[Header("Level Progression")]
GameObject victoryCanvas;
[Header("Unlocked Items")]
[SerializeField] public bool unlockedTrumpet = false;
[SerializeField] public bool unlockedTambourine = false;
[SerializeField] public bool unlockedClarinet = false;
void Awake() {
// check to see if a state controller already exists
if (GameObject.FindGameObjectWithTag("StateController") != null) {
@@ -41,7 +46,9 @@ public class StateController : MonoBehaviour {
}
}
void OnSceneLoaded(Scene scene, LoadSceneMode mode) {
void OnSceneLoaded(Scene scene, LoadSceneMode mode) {
#region FIND OBJECTS
deathCanvas = GameObject.Find("DeathUICanvas");
if (deathCanvas != null) {
Button respawnButton = GameObject.Find("RespawnButton").GetComponent<Button>();
@@ -73,6 +80,25 @@ public class StateController : MonoBehaviour {
if (isPaused) {
Unpause();
}
#endregion
#region UNLOCK ITEMS
if (SceneManager.GetActiveScene().name == "GrenouilleVillage") {
unlockedTrumpet = false;
unlockedTambourine = false;
unlockedClarinet = false;
}
else if (SceneManager.GetActiveScene().name == "GrappleScene") {
unlockedTrumpet = true;
unlockedTambourine = true;
unlockedClarinet = false;
}
else if (SceneManager.GetActiveScene().name == "ClarinetScene") {
unlockedTrumpet = true;
unlockedTambourine = true;
unlockedClarinet = true;
}
#endregion
}
void OnToggleDebugMenu() {