private static void PlayMusic(LevelWaveMusicSettings musicSettings) { if (!_isValid) { LevelSettings.LogIfNew( "WaveMusicChanger is not attached to any prefab with an AudioSource component. Music in Core GameKit LevelSettings will not play."); return; } if (_statListener != null) { _statListener.MusicChanging(musicSettings); } _isFading = false; switch (musicSettings.WaveMusicMode) { case LevelSettings.WaveMusicMode.PlayNew: _statAudio.Stop(); _statAudio.clip = musicSettings.WaveMusic; _statAudio.volume = musicSettings.WaveMusicVolume; _statAudio.Play(); break; case LevelSettings.WaveMusicMode.Silence: _isFading = true; _fadeStartTime = Time.time; _fadeStartVolume = _statAudio.volume; _fadeTotalTime = musicSettings.FadeTime; break; case LevelSettings.WaveMusicMode.KeepPreviousMusic: _statAudio.volume = musicSettings.WaveMusicVolume; break; } }
private static void PlayMusicIfSet(LevelWaveMusicSettings musicSpec) { if (Instance.useMusicSettings && Instance.useWaves && musicSpec != null) { WaveMusicChanger.WaveUp(musicSpec); } }
public static void WaveUp(LevelWaveMusicSettings newWave) { PlayMusic(newWave); }
public static void PlayGameOverMusic(LevelWaveMusicSettings musicSettings) { PlayMusic(musicSettings); }
/// <summary> /// This method gets called when the music will change to a different song. /// </summary> /// <param name="musicSettings">The settings for the new music.</param> public virtual void MusicChanging(LevelWaveMusicSettings musicSettings) { // your code here. }