public void NextLevel() { int sceneCount = SceneManager.sceneCountInBuildSettings; int currentSceneIndex = SceneManager.GetActiveScene().buildIndex; if (currentSceneIndex < sceneCount) { SavingPassedLevel.OnLevelComplete(SceneManager.GetActiveScene().buildIndex); SceneManager.LoadScene(currentSceneIndex + 1); } }
private IEnumerator ChangePhase() { yield return(new WaitForSeconds(2.0f)); _phases[_currentIndex].OnEndPhase(); _phases[_currentIndex].gameObject.SetActive(false); _currentIndex++; if (_currentIndex > _phaseCount - 1) { Time.timeScale = 0; SavingPassedLevel.OnLevelComplete(2); _endLevelPanel.SetActive(true); } else { _phases[_currentIndex].gameObject.SetActive(true); _phases[_currentIndex].OnStartPhase(); } }
private void FinishGame(bool isWin) { Time.timeScale = 0; if (isWin) { if (SavingPassedLevel.GetCountLevels() == SavingPassedLevel.GetPassedLevels() + 1) { _allLevelsCompletedPanel.SetActive(true); } else { SavingPassedLevel.OnLevelComplete(SceneManager.GetActiveScene().buildIndex + 1); _gameWinPanel.SetActive(true); } } else { _gameOverPanel.SetActive(true); } }