public void Transition(MusicTrack newTrack) { if (currentTrack != null) { StartCoroutine(TransitionTimer(newTrack)); } else { currentTrack = newTrack; StartTrack(); } }
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(); }