Ejemplo n.º 1
0
    IEnumerator CrossFade_(StemPlayer stemsIn, AudioSource audioOut, float xfadeTime)
    {
        // Same principle as the former funtions.
        while (isFading)
        {
            yield return(null);
        }
        isFading = true;
        stemsIn.Play(xfadeTime);
        fader.FadeOutAndStop(audioOut, xfadeTime);

        yield return(new WaitForSeconds(xfadeTime));

        isFading = false;
    }
Ejemplo n.º 2
0
    // The MusicController will not be ready until all stemPlayers are ready. Any other future initialization should be put here as well.
    // Any component that wishes to use the music controller should check if it's ready before the first use.
    IEnumerator InitializePlayers_()
    {
        for (int i = 0; i < stemPlayers.Length; i++)
        {
            while (!stemPlayers[i].StemPlayerReady())
            {
                yield return(null);
            }
        }
        musicControllerReady = true;
        mainLoopMusic        = stemPlayers[0];

        mainLoopMusic.Play();

        StartCoroutine(MainLoop_());
    }
Ejemplo n.º 3
0
 // Starts the main loop music. All ongoing coroutines and invokes will be cancelled.
 public void PlayMainLoopMusic()
 {
     CancelInvoke();
     StopAllCoroutines();
     mainLoopMusic.Play();
 }