BackgroundMusic ChooseTheme() { List <BackgroundMusic> soundList = GetAllThemesFor(SceneManager.GetActiveScene().name); BackgroundMusic theme = soundList[UnityEngine.Random.Range(0, soundList.Count)]; return(theme); }
void PlayTheme(BackgroundMusic theme) { if (isAudioMute) { return; } if (currentlyPlayedTheme != null) { StartCoroutine(currentlyPlayedTheme.SwellDown()); } Play(this.gameObject, theme, true); theme.myRoutine = StartCoroutine(theme.SwellUp()); currentlyPlayedTheme = theme; }