/// <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> /// 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."); } }