Description
The Sounds
property of the SoundEvent
class is a list of SoundFile
objects. This property allows you to specify multiple sound files that can be played as part of a sound event. When the sound event is triggered, a random sound from this list will be selected and played.
Usage
To use the Sounds
property, you need to add SoundFile
objects to the list. These sound files will be used by the SoundEvent
to play audio. You can manage the list by adding or removing SoundFile
instances as needed.
Example
// Example of using the Sounds property
SoundEvent mySoundEvent = new SoundEvent();
// Create sound files
SoundFile sound1 = new SoundFile("path/to/sound1.wav");
SoundFile sound2 = new SoundFile("path/to/sound2.wav");
// Add sound files to the Sounds list
mySoundEvent.Sounds.Add(sound1);
mySoundEvent.Sounds.Add(sound2);
// When the sound event is triggered, one of the sounds will be played
mySoundEvent.Play();