private void LevelPassedConversation() { GameManager gameManager = GameManager.Instance; LevelEndingData ending = gameManager.LevelData.Ending; ending.SayEndingConversation(); gameManager.m_dialogueManager.StartInteractiveConversation(); // If the ending is a quiz then subscribe to its conversation ended event if (ending.IsQuiz) { ending.ActiveQuizConversation.OnConversationEnded.AddListener(OnSuccessConversationEnded); } // If the ending is not a quiz then subscribe to the ending event for the non-quiz conversation else { ending.ActiveConversation.OnConversationEnded(OnSuccessConversationEnded); } }
private void OnSuccessConversationEnded() { // Update the save data with the id of the level we are qualified to go to LevelEndingData ending = GameManager.Instance.LevelData.Ending; SaveData.QualifyForLevel(ending.GetNextLevelID()); // Compute the rating for this level int rating = LevelRatingSystem.RateCurrentLevel(); SaveData.SetLevelRating(LevelID.Current(), rating); // Save changes to the save data SaveData.Save(); // Let the game manager handle level exiting GameManager.Instance.HandleExitLevel(); // Open the success window OpenWindow(successWindow, () => LevelDataLoader.LoadNextLevel(), () => SceneManager.LoadScene("LevelMenu")); }