// interface public static void UnlockNextLevel() { if (SceneLoader.HasNextLevel()) { string nextLevelName = SceneLoader.GetNextLevelName(); if (ProgressState.Locked.IsStateOf(nextLevelName)) { ProgressState.SetProgressState(nextLevelName, ProgressState.Unlocked); } } }
// initialisation private void Awake() { if (PlayerPrefs.GetString("LevelsInitialised") != "True") { foreach (string levelName in SceneLoader.GetLevelNames()) { ProgressState.SetProgressState(levelName, ProgressState.Locked); } ProgressState.SetProgressState(SceneLoader.GetLevelName(1), ProgressState.Unlocked); PlayerPrefs.SetString("LevelsInitialised", "True"); } }
private void PlayerSuccess() { string currentLevelName = SceneLoader.GetCurrentLevelName(); if (!ProgressState.Optimal.IsStateOf(currentLevelName)) { if (_moveNumber <= OptimalSolutionDecider.GetOptimalNumberOfMoves(currentLevelName)) { ProgressState.SetProgressState(currentLevelName, ProgressState.Optimal); _successCounter.color = _optimalColour; } else if (!ProgressState.Complete.IsStateOf(currentLevelName)) { ProgressState.SetProgressState(currentLevelName, ProgressState.Complete); } } LevelLockController.UnlockNextLevel(); SwitchToSuccessUI(); }