bool Occlusion { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Occlusion property of the SoundEvent class determines whether the sound can be occluded by geometry. When set to true, the sound will be affected by obstacles in the environment, potentially reducing its volume or altering its characteristics based on the geometry between the sound source and the listener.

Usage

To use the Occlusion property, simply set it to true or false depending on whether you want the sound to be occluded by geometry. This property is part of the SoundEvent class, which is used to define how sounds are played in the game environment.

Example

// Example of setting the Occlusion property
SoundEvent mySoundEvent = new SoundEvent();
mySoundEvent.Occlusion = true; // Enable occlusion for this sound event

// Further configuration of the sound event can be done here
mySoundEvent.Volume = new RangedFloat(0.5f, 1.0f);
mySoundEvent.Pitch = new RangedFloat(0.8f, 1.2f);

// Add sound files to the event
mySoundEvent.Sounds.Add(new SoundFile("path/to/sound1.wav"));
mySoundEvent.Sounds.Add(new SoundFile("path/to/sound2.wav"));