private void Awake()
        {
            Instance = this;
            PlayerSettings.Load();

            for (var i = 0; i < audioSourceCount - 1; i++)
            {
                var source = CreateAudioSource();
                source.volume = PlayerSettings.SfxVolume;
                source.mute   = PlayerSettings.MuteSfx;
                sfxSources.Add(source);
            }

            menuSource      = CreateAudioSource("MusicSource");
            menuSource.mute = PlayerSettings.MuteMusic;

            FadeInMusic(0.5f);
        }
Exemple #2
0
        private void OnToggleValueChanged(bool isOn)
        {
            switch (audioType)
            {
            case AudioType.Music:
                AudioClipPlayer.MuteMusic(isOn);
                break;

            case AudioType.Sfx:
                AudioClipPlayer.MuteSfx(isOn);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            AudioClipPlayer.PlayButton();
            PlayerSettings.Save();
        }
Exemple #3
0
        private void OnValueChanged(float volume)
        {
            if (ignoreValueChanged)
            {
                return;
            }

            switch (audioType)
            {
            case AudioType.Music:
                AudioClipPlayer.SetMusicVolume(volume);
                break;

            case AudioType.Sfx:
                AudioClipPlayer.SetSfxVolume(volume);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Exemple #4
0
 private static void OnClick()
 {
     AudioClipPlayer.PlayButton();
 }