The Play method can be used to play a SoundEffect, optionally specifying the volume to play at. The Play method performs the following additional logic:
It only plays the SoundEffect if AreSoundEffectsEnabled is true.
It checks if the SoundEffect has already been played this frame, preventing the same SoundEffect from playing twice in one frame. This behavior depends on the value of SoundEffectPlayingBehavior.
It increments NumberOfSoundEffectPlays which can be used to measure how many times sound effects have played.
It checks if the argument SoundEffect has been disposed (debug only) and throws an informative exception if so.
The following assumes that Explosion is a SoundEffect. This can be created by adding a .wav file to Glue.
Sounds can be played with a custom volume: