private void Start() { state = BackgroundMusicState.Intro; nextStartTime = AudioSettings.dspTime + 2; previousOfficeState = OfficeState.Chill; nextClip = GetNextClip(); playNext(nextClip); }
private AudioClip GetNextClip() { if (previousOfficeState != office.State) { state = BackgroundMusicState.Intro; } previousOfficeState = office.State; switch (office.State) { case OfficeState.Chill: if (state == BackgroundMusicState.Intro) { nextClip = chillStart; } else { nextClip = chillLoop; } break; case OfficeState.Tense: if (state == BackgroundMusicState.Intro) { nextClip = tenseStart; } else { nextClip = tenseLoop; } break; case OfficeState.Riot: nextClip = riotLoop; break; } if (state == BackgroundMusicState.Intro) { state = BackgroundMusicState.Loop; } return(nextClip); }