Description
The AudioSurface.Water
field represents a specific type of audio surface in the Sandbox environment. This enumeration value is used to define the acoustic properties of water surfaces, affecting how sound interacts with them. When an object interacts with a water surface, the sound produced will be modified to reflect the unique characteristics of water, such as its ability to dampen and alter sound waves.
Usage
Use AudioSurface.Water
when you need to specify that a surface in your game environment should have the acoustic properties of water. This can be useful for creating realistic audio effects when objects interact with water surfaces, such as splashes or underwater sounds.
Example
// Example of using AudioSurface.Water in a game scene
public class WaterSoundComponent : Component
{
public override void OnCollisionEnter(Collision collision)
{
if (collision.SurfaceType == AudioSurface.Water)
{
// Play water interaction sound
PlayWaterSound();
}
}
private void PlayWaterSound()
{
// Logic to play a water sound effect
}
}