created victory object and level progression
also tried to create a way to launch the game from any scene, but it doesn't really work. don't use anything in the folder called "DEBUG"
This commit is contained in:
@@ -22,6 +22,9 @@ public class StateController : MonoBehaviour {
|
||||
[Header("Enemies")]
|
||||
GameObject[] enemiesInScene;
|
||||
|
||||
[Header("LevelProgression")]
|
||||
GameObject victoryCanvas;
|
||||
|
||||
void Awake() {
|
||||
// check to see if a state controller already exists
|
||||
if (GameObject.FindGameObjectWithTag("StateController") != null) {
|
||||
@@ -33,7 +36,7 @@ public class StateController : MonoBehaviour {
|
||||
SceneManager.sceneLoaded += OnSceneLoaded;
|
||||
|
||||
if (inDebugMode) {
|
||||
debugCanvas = GameObject.Find("DebugCanvas");
|
||||
debugCanvas = GameObject.FindGameObjectWithTag("DebugCanvas");
|
||||
debugCanvas.SetActive(false);
|
||||
}
|
||||
}
|
||||
@@ -53,6 +56,13 @@ public class StateController : MonoBehaviour {
|
||||
TogglePauseMenu(false);
|
||||
}
|
||||
|
||||
victoryCanvas = GameObject.Find("VictoryCanvas");
|
||||
if (victoryCanvas != null) {
|
||||
Button continueButton = GameObject.Find("ContinueButton").GetComponent<Button>();
|
||||
continueButton.onClick.AddListener(ContinueToNextLevel);
|
||||
victoryCanvas.SetActive(false);
|
||||
}
|
||||
|
||||
// keep track of all enemies
|
||||
enemiesInScene = GameObject.FindGameObjectsWithTag("Enemy");
|
||||
// print(enemiesInScene);
|
||||
@@ -107,4 +117,12 @@ public class StateController : MonoBehaviour {
|
||||
public void SetDeathCanvasActive(bool activeState) {
|
||||
deathCanvas.SetActive(activeState);
|
||||
}
|
||||
|
||||
public void ShowVictoryCanvas() {
|
||||
victoryCanvas.SetActive(true);
|
||||
}
|
||||
|
||||
public void ContinueToNextLevel() {
|
||||
GameObject.FindGameObjectWithTag("SceneManager").GetComponent<SceneController>().NextScene();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user