private static void Play(float volume, EnhancedSoundEffect sound) { foreach (var psi in soundList) { if (psi.Priority > sound.Priority) { return; } } var soundInstance = sound.CreateSoundInstance(); if (soundInstance == null) { return; } soundInstance.Volume = volume; var prioritizedSoundInstance = new PrioritizedSoundInstance( soundInstance, sound.Priority, sound.PriorityDecayRate); soundInstance.Play(); soundList.Add(prioritizedSoundInstance); }
/// <summary> /// Plays a sound. /// </summary> /// <param name="sound">The sound to play.</param> public static void Play(EnhancedSoundEffect sound) { if (soundList == null) { return; } Play(Volume, sound); }
/// <summary> /// Plays a sound with the specified volume. /// </summary> /// <param name="volume">The volume that the sound will be played at.</param> /// <param name="sound">The sound to play.</param> public static void PlayWithVolume(float volume, EnhancedSoundEffect sound) { Play(volume, sound); }