コード例 #1
0
        private void SetMixerGroupVolume(SavablePlayerPrefsValue <float> mixerGroup, float value, string mixerGroupName)
        {
            float bottomValueAccordingToScale = 0.0001f;

            Mathf.Clamp(value, bottomValueAccordingToScale, 1);
            value = Mathf.Log10(value) * normalizer;

            mixerGroup.Value = value;
            audioMixer.SetFloat(mixerGroupName, value);
        }
コード例 #2
0
        public void InitSettings()
        {
            SFXIsMuted   = new SavablePlayerPrefsValue <bool>("SFXisMuted", false);
            MusicIsMuted = new SavablePlayerPrefsValue <bool>("MusicisMuted", false);

            masterVolume = new SavablePlayerPrefsValue <float>(MasterGroupVolumeName, 0f);
            sfxVolume    = new SavablePlayerPrefsValue <float>(SFXGroupVolumeName, 0f);
            musicVolume  = new SavablePlayerPrefsValue <float>(MusicGroupVolumeName, 0f);

            audioMixer.SetFloat(MasterGroupVolumeName, masterVolume.Value);
            audioMixer.SetFloat(MusicGroupVolumeName, (MusicIsMuted.Value ? minVolume : musicVolume.Value));
            audioMixer.SetFloat(SFXGroupVolumeName, (SFXIsMuted.Value ? minVolume : sfxVolume.Value));
        }
コード例 #3
0
 private void SetMixerGroupMuted(string mixerGroupName, bool isMuted, SavablePlayerPrefsValue <float> mixerGroup)
 {
     audioMixer.SetFloat(mixerGroupName, (isMuted ? minVolume : mixerGroup.Value));
 }