public void LevelComplete(int sceneIndex) { // if the game has ended no action will be done if (levelComplete) { return; } Debug.Log("LEVEL COMPLETE"); levelComplete = true; DisableGameElements(); int lastCompleteIndex = PlayerPrefs.GetInt(Level.NEXT_LEVEL_KEY, Level.LEVEL_TO_START); // getting last complete scene index Debug.Log("LastCompleteLevelIndex = " + lastCompleteIndex); /* Level level = FindObjectOfType<Level>(); * if (sceneIndex > level.GetTotalSceneNumber()) * { * level.SetGameOverKey(); * }*/ // if sceneIndex is greater or equal than lastCompleteIndex // (this means that we completed this level for the first time or play the level once again) if (sceneIndex >= lastCompleteIndex) { // setting this level index to PlayerPrefs Debug.Log("NextLevelToPlay = " + (sceneIndex + 1)); PlayerPrefs.SetInt(Level.NEXT_LEVEL_KEY, sceneIndex + 1); //PlayerPrefs.SetInt(Level.LAST_LEVEL_KEY, sceneIndex); } cameraAnimator.SetLevelCompleteTrigger(); // activatin level complete animatin by setting up the trigger }
public void LevelComplete(int sceneIndex) { DisableGameElements(); int nextLevelIndex = PlayerPrefs.GetInt(Level.NEXT_LEVEL_KEY, Level.LEVEL_TO_START); if (sceneIndex >= nextLevelIndex) { PlayerPrefs.SetInt(Level.NEXT_LEVEL_KEY, sceneIndex + 1); } animator.SetLevelCompleteTrigger(); }
public void LevelComplete(int sceneIndex) { // if the game has ended no action will be done if (gameEnded) { return; } Debug.Log("LEVEL COMPLETE"); gameEnded = true; DisableGameElements(); int nextLevelIndex = PlayerPrefs.GetInt(Level.NEXT_LEVEL_KEY, Level.LEVEL_TO_START); // getting last complete scene //Debug.Log("nextLevelIndex = " + nextLevelIndex); // if sceneIndex is greater than nextLevelIndex (this means that we complete this level for the first time) if (sceneIndex >= nextLevelIndex) { // setting this level index to PlayerPrefs //Debug.Log(sceneIndex); PlayerPrefs.SetInt(Level.NEXT_LEVEL_KEY, sceneIndex + 1); //PlayerPrefs.SetInt(Level.LAST_LEVEL_KEY, sceneIndex); } cameraAnimator.SetLevelCompleteTrigger(); // activatin level complete animatin by setting up the trigger }
public void LevelComplete() { DisableGameElements(); animator.SetLevelCompleteTrigger(); }