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); }
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(); }
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(); } }
private static void OnClick() { AudioClipPlayer.PlayButton(); }