public void Transition(MusicTrack newTrack)
 {
     if (currentTrack != null)
     {
         StartCoroutine(TransitionTimer(newTrack));
     }
     else
     {
         currentTrack = newTrack;
         StartTrack();
     }
 }
示例#2
0
 public void Transition(MusicTrack newTrack)
 {
     maxLayers = newTrack.max_parallel_tracks;
     minLayers = newTrack.min_parallel_tracks;
     if (currentTrack != null)
     {
         StartCoroutine(TransitionTimer(newTrack));
     }
     else
     {
         currentTrack = newTrack;
         StartTrack();
     }
 }
        IEnumerator TransitionTimer(MusicTrack newTrack)
        {
            float goTime = Time.time + SecondsToNextBeat();

            while (Time.time < goTime)
            {
                yield return(null);
            }

            for (int i = 0; i <= currentListLenght; i++)
            {
                StartCoroutine(FadeOutAndStop(currentSources[i], transitionFadeTimeInSeconds));
                currentSources[i].gameObject.name = "MusicTrack (Old)";
            }

            currentTrack = newTrack;
            StartTrack();
        }