private void UpdateCoinsStatsForLevel(int level) { int neededCoins = GamePrefController.LoadLevelRequrement(level + 1); neededCoinsText.text = neededCoins.ToString(); playButton.interactable = neededCoins <= totalCoins; }
public void LoadNextLevel() { int totalCoins = GamePrefController.GetTotalCoinsForLevels(SceneManager.sceneCountInBuildSettings); int nextSceneIndex = SceneManager.GetActiveScene().buildIndex; do { nextSceneIndex++; } while (GamePrefController.LoadLevelRequrement(nextSceneIndex) > totalCoins && nextSceneIndex < SceneManager.sceneCountInBuildSettings); if (nextSceneIndex >= SceneManager.sceneCountInBuildSettings) { LoadMainMenuScene(); } else { SceneManager.LoadScene(nextSceneIndex); } Time.timeScale = 1; }