/// <summary> /// Start game UI animation. /// </summary> /// <returns>IEnumerator</returns> public IEnumerator StartGameAnim() { StartCoroutine(_audio.FadeOutSongRoutine()); screenCover.FadeIn(.6f); yield return(new WaitForSecondsRealtime(startGameAnimationWait)); title.FadeOut(.1f); }
/// <summary> /// Reproduce song. /// </summary> /// <param name="clip">AudioClip - audio clip to reproduce</param> /// <param name="inmediateStart">bool - wheter to start the song inmediately or fade songs.</param> private IEnumerator ReproduceSong(AudioClip clip, bool inmediateStart) { if (_audio != null) { if (inmediateStart) { _audio.PlayClip(clip); } else { StartCoroutine(_audio.FadeOutSongRoutine(0.3f, false)); yield return(new WaitForSecondsRealtime(2.5f)); _audio.PlayClip(clip, false); StartCoroutine(_audio.FadeInSongRoutine(0.7f, 0f, .5f)); } } }
/// <summary> /// Play heated animation. /// </summary> /// <returns>IEnumerator</returns> private IEnumerator PlayHeatedAnim() { float downVolumeSpeed = 0.5f; // display smoke particles. foreach (ParticleSystem smokeParticle in heatedSmokeParticles) { smokeParticle.Play(); } // play audio. if (!heatedAudio.onFade) { heatedAudio.PlaySound(); yield return(new WaitForSeconds(2f)); StartCoroutine(heatedAudio.FadeOutSongRoutine(downVolumeSpeed)); } _heatedRoutine = null; }