/// <summary> /// Changes to an ending depending on the current state of the pet. /// </summary> public void toStandardEnding() { int formIndex = petForm.getPetFormIndex(); string targetSceneName = petStatus.isSatisfied() ? goodEndingScenes[formIndex] : badEndingScenes[formIndex]; changeScenes(targetSceneName); }
// Update is called once per frame void Update() { // crossfading if (fading) { float fadeDelta = Time.deltaTime / FADE_DURATION; if (onNormalSong) { normalBGM.volume += fadeDelta; upsetBGM.volume -= fadeDelta; if (normalBGM.volume >= 1 && upsetBGM.volume <= 0) { normalBGM.volume = 1; upsetBGM.volume = 0; upsetBGM.Stop(); fading = false; } } else { normalBGM.volume -= fadeDelta; upsetBGM.volume += fadeDelta; if (normalBGM.volume <= 0 && upsetBGM.volume >= 1) { normalBGM.volume = 0; upsetBGM.volume = 1; normalBGM.Stop(); fading = false; } } } // Switching songs if (songFreeze > 0) { songFreeze -= Time.deltaTime; } else if (twoSongs) { bool notUpset = petStatus.isSatisfied() && !petStatus.isHungry(); if (onNormalSong && !notUpset) { fadeToUpset(); } else if (!onNormalSong && notUpset) { fadeToNormal(); } } }