private void Start() { foreach (Level lvl in levels) { lvl.levelID = levels.IndexOf(lvl); lvl.lvlButton = lvl.gameObject.GetComponent <Button>(); Buttons.Insert(lvl.levelID, lvl.lvlButton); foreach (Button button in Buttons) { if (Buttons.IndexOf(button) == lvl.levelID) { button.onClick.AddListener(delegate { menuScript.ChangeScene(lvl.levelName); }); } } if (lvl.levelID == PlayerPrefs.GetInt("unlockedLevel")) { EventSystem.current.firstSelectedGameObject = lvl.lvlButton.gameObject; } if (lvl.levelID > PlayerPrefs.GetInt("unlockedLevel")) { lvl.lvlButton.interactable = false; } else if (lvl.levelID <= PlayerPrefs.GetInt("unlockedLevel")) { lvl.lvlButton.interactable = true; } } }
public override void Interaction() { menuScript.ChangeScene(sceneToGoTo); /*if (sceneToGoTo == "SecondFloor") * Cursor.visible = false; * if (sceneToGoTo == "2nd level") * Cursor.visible = false; * if (sceneToGoTo == "MainMenu") * { * Cursor.lockState = CursorLockMode.None; * Cursor.visible = true; * } * if (sceneToGoTo == "Victory") * { * Cursor.lockState = CursorLockMode.None; * Cursor.visible = true; * } * SceneManager.LoadScene(sceneToGoTo);*/ }
void CheckOver(UnityEngine.Video.VideoPlayer vp) { menuScript.ChangeScene("MainMenu"); }
private void GameOver() { menuScript.ChangeScene("Game Over"); }