Exemplo n.º 1
0
        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);
        }
Exemplo n.º 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();
        }
Exemplo n.º 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();
            }
        }
Exemplo n.º 4
0
 private static void OnClick()
 {
     AudioClipPlayer.PlayButton();
 }