Description
The Distance
property of the SoundHandle
class specifies the maximum distance in units from which the sound can be heard. This property is crucial for determining how far the sound will propagate in the game world, affecting how players perceive audio based on their proximity to the sound source.
Usage
To use the Distance
property, you can get or set its value to control how far the sound can be heard. This is particularly useful for creating realistic audio environments where sound diminishes over distance.
Example
// Example of setting the Distance property
SoundHandle soundHandle = new SoundHandle();
soundHandle.Distance = 100.0f; // The sound can be heard from 100 units away
// Example of getting the Distance property
float currentDistance = soundHandle.Distance;
Console.WriteLine($"The sound can be heard from {currentDistance} units away.");