RangedFloat Volume { get; set; }

robot_2Generated
code_blocksInput

Description

The Volume property of the SoundEvent class specifies how loud the sound should be. It is represented as a RangedFloat, allowing for precise control over the volume level within a specified range.

Usage

Use the Volume property to adjust the loudness of a sound event. The value is a RangedFloat that can be set between 0 and 1, where 0 is completely silent and 1 is the maximum volume. The property is designed to be adjusted in increments of 0.01 for fine-tuning.

Example

// Create a new SoundEvent instance
SoundEvent soundEvent = new SoundEvent();

// Set the volume to 0.75 (75% of the maximum volume)
soundEvent.Volume = new RangedFloat(0.75f, 0, 1, 0.01f);

// Access the current volume level
RangedFloat currentVolume = soundEvent.Volume;
float volumeValue = currentVolume.Value;

// Output the current volume value
// Note: Avoid using Console.WriteLine in Sandbox
// Instead, use logging or UI elements to display information
Log.Info($"Current Volume: {volumeValue}");