public virtual void LoadLevel(string levelName) { if (StageManager.isLevelUnlocked(levelName)) { PlayerPrefs.SetString("NextLevelId", nextLevelId); SceneManager.LoadScene(levelName); } }
// Use this for initialization void Start() { for (int i = 0; i < buttons.Length; i++) { if (buttons[i].setToUnlock) { StageManager.UnlockLevel(buttons[i]); } if (StageManager.isLevelUnlocked(buttons[i])) { buttons[i].button.interactable = true; } else { buttons[i].button.interactable = false; } //buttons[i].button.onClick.AddListener(() => { LoadLevel(buttons[i]); }); } }
// Use this for initialization void Start() { unlockBtn.onClick.AddListener(() => { StageManager.UnlockNextLevel(); }); lockBtn.onClick.AddListener(() => { StageManager.LockLevel(PlayerPrefs.GetString("NextLevelId")); }); }