Пример #1
0
        void Awake()
        {
            var slider = GetComponent <Slider>();

            slider.value = Settings.GetFloat(key.Strings(), 1f);
            slider.onValueChanged.AddListener((value) => {
                Settings.SetFloat(key.Strings(), value);
                if (audioClip == null)
                {
                    return;
                }
                if (notifyCoroutine != null)
                {
                    StopCoroutine(notifyCoroutine);
                }
                notifyCoroutine = StartCoroutine(NotifyAudioVolume(value));
            });
        }
Пример #2
0
        void Awake()
        {
            var audioSource = GetComponent <AudioSource>();

            audioSource.volume = Settings.GetFloat(key.Strings(), 1);
            Settings.OnChange.AddListener((key) => {
                if (key != this.key.Strings())
                {
                    return;
                }
                audioSource.volume = Settings.GetFloat(key, 1);
            });
        }