player can only access items in correct scenes
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user