void FadeIntoTitleScreen() { if (!screenFader.isFading) { musicFader.FadeIntoClip(titleMusic, 0.8f, 1f, 1f); screenFader.Fade(1, 1); screenFader.FadeEnd.AddListener(() => SceneManager.LoadScene("TitleScreen")); } }
void VictorySequence() { // Play music, fade into a victory screen, and then give the player the // option to either exit the game or start a new one. Debug.Log("You win!"); PlayerWon.RemoveListener(victorySequence); //resultText.text = "You win! You are now promoted to Admiral!"; // Fade out of the current song into the next one musicFader.FadeIntoClip(victoryMusic, 1, 0.5f, 0.5f); screenFader.Fade(1, fadeOutDuration); // Make sure the victory scene is loaded when the fade out is done. //UnityAction undisplayResultText = () => resultText.text = ""; //screenFader.FadeEnd.AddListener(undisplayResultText); screenFader.FadeEnd.AddListener(LoadVictoryScene); //screenFader.FadeEnd.AddListener(ResetGameState); }
public void PlaySong(AudioClip clip) { // Mainly for use in the inspector, so that when you get back to the title // menu, the victory/game over music gives way to the title music. audioFader.FadeIntoClip(clip, 0.8f, 0.5f, 0.5f); }