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:
Sam
2023-04-30 13:34:02 -07:00
parent 1b809cfa06
commit 16a190949d
40 changed files with 4171 additions and 1889 deletions

View File

@@ -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();
}
}