SanAndreasUnity/Assets/Scripts/Settings/SoundSettings.cs
2021-01-02 19:37:11 +01:00

24 lines
724 B
C#

using SanAndreasUnity.UI;
using UnityEngine;
namespace SanAndreasUnity.Settings
{
public class SoundSettings : MonoBehaviour
{
[Range(0f, 1f)] public float defaultSoundVolume = 0.5f;
OptionsWindow.FloatInput m_soundVolume = new OptionsWindow.FloatInput ("Sound volume", 0, 1) {
getValue = () => AudioListener.volume,
setValue = (value) => { AudioListener.volume = value; },
persistType = OptionsWindow.InputPersistType.OnStart
};
private void Awake()
{
// apply default value
AudioListener.volume = this.defaultSoundVolume;
OptionsWindow.RegisterInputs ("SOUND", m_soundVolume);
}
}
}