예제 #1
0
 public override void Dispose()
 {
     foreach (var sound in _playingInstances) sound.Dispose();
     foreach (var sound in _createdInstances.Select(x => x.Target).Where(x => x != null).Cast<SoundInstance>()) sound.Dispose();
     if (_music != null) _music.Dispose();
     _music = null;
     base.Dispose();
 }
예제 #2
0
 public void PlayMusic(string trackName, float trackVolume)
 {
     if (!Enabled) return;
     var changeTrack = _music == null || _music.TrackName != trackName;
     if (changeTrack) StopMusic();
     RelativeMusicVolume = trackVolume;
     InternalMusicVolume = 1;
     if (changeTrack)
     {
         if (_music != null) _music.Dispose();
         _music = new AWMusic(Game.Content, trackName) { Volume = ActualMusicVolume };
         _music.EnsureIsPlaying();
     }
 }