Now, your project manager wants you to add different sound effects associated with different game events. Sometimes, these sounds have to be played concurrently. For example, a thunder can happen at the same time as the player applies an impulse to an UFO.
It is time to create a simple yet useful sound manager class. It must be able to handle many concurrent sound banks:
1. Stay in the
3DInvadersSilverlight
project.2. Create a new class—
SoundManager
.3. Add the following lines of code at the beginning of the class definition (as we are going to use the
System.Collections.Generic.List
class):using System.Collections.Generic;
4. Add the following
private
andstatic
variables:// The target for the new MediaElement instances (it must be a Panel subclass) private static Panel _target; // The last sound bank used private int _lastSoundBank = -1; // The number of sound banks available private static int SoundBanks = 5; // The default media...