예제 #1
0
    /// Actual implementation of <see cref="BGMFadeBetweenTracks(ESoundTypes, ESoundTypes)"/>.
    /// This is done so that users of the SoundManager won't have to call the function as a coroutine.
    private IEnumerator BGMFadeImplementation(SoundManager.ESoundTypes _in, SoundManager.ESoundTypes _out, float _fading_time, float _in_volume)
    {
        StartBGM(_in, 0);
        ChangeBGMVolume(_in, _in_volume, _fading_time);
        ChangeBGMVolume(_out, 0, _fading_time);
        yield return(new WaitForSeconds(_fading_time));  // Wait for the fading time before actually stopping the out BGM

        StopBGM(_out);
    }
예제 #2
0
 /// <summary>
 /// Fades between the "in" and "out" tracks in the given time.
 /// </summary>
 /// <param name="_in">The track to start playing and fade in.</param>
 /// <param name="_out">The track to fade out and stop playing.</param>
 /// <param name="_fading_time">The time it takes to completely fade from one track to the other.</param>
 /// <param name="_in_volume">Final volume of the track faded in.</param>
 public void BGMFadeBetweenTracks(SoundManager.ESoundTypes _in, SoundManager.ESoundTypes _out, float _fading_time, float _in_volume)
 {
     StartCoroutine(BGMFadeImplementation(_in, _out, _fading_time, _in_volume));
 }