예제 #1
0
    /// <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));
            }
        }
    }