A stealth-based 2D platformer where you don't have to kill anyone unless you want to. https://www.semicolin.games
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
677 B

  1. using Microsoft.Xna.Framework.Audio;
  2. using System;
  3. namespace SemiColinGames {
  4. public class MusicPlayer : IDisposable {
  5. private SoundEffectInstance music;
  6. ~MusicPlayer() {
  7. Dispose();
  8. }
  9. public void Dispose() {
  10. Stop();
  11. music?.Dispose();
  12. GC.SuppressFinalize(this);
  13. }
  14. public void Load(SoundEffect sound) {
  15. if (sound == null) {
  16. return;
  17. }
  18. music = sound.CreateInstance();
  19. music.IsLooped = true;
  20. music.Volume = 0.1f;
  21. }
  22. public void Stop() {
  23. music?.Stop();
  24. }
  25. public void Pause() {
  26. music?.Pause();
  27. }
  28. public void Play() {
  29. music?.Play();
  30. }
  31. }
  32. }