/// <summary> /// Plays a sound with positional effects /// </summary> /// <param name="identifier">the name of the sound file</param> /// <param name="listenerPosition">the position of the listener</param> /// <param name="emitterPosition">the position of the emitter</param> /// <param name="volume">the volume of the sound</param> public void PlaySound(string identifier, float volume, Vector2 listenerPosition, Vector2 emitterPosition) { SoundContainer sound = sounds.Find(snd => snd.Identifier == identifier); if (sound != null) { sound.Play(volume, listenerPosition, emitterPosition); } else { throw new Exception("Sound \"" + identifier + "\" does not exist."); } }
/// <summary> /// Resumes a sound /// </summary> /// <param name="identifier">the name of the sound file</param> public void ResumeSound(string identifier) { SoundContainer sound = sounds.Find(snd => snd.Identifier == identifier); if (sound != null) { sound.Resume(); } else { throw new Exception("Sound \"" + identifier + "\" does not exist."); } }
/// <summary> /// Plays a sound without any positional effects /// </summary> /// <param name="identifier">the name of the sound file</param> /// <param name="volume">the volume of the sound</param> public void PlaySound(string identifier, float volume) { SoundContainer sound = sounds.Find(snd => snd.Identifier == identifier); if (sound != null) { sound.ChangeVolume(volume); sound.Play(); } else { throw new Exception("Sound \"" + identifier + "\" does not exist."); } }
/// <summary> /// Adds a sound to the list /// </summary> /// <param name="sound"></param> public void AddSound(SoundContainer sound) { sounds.Add(sound); }