Пример #1
0
        public static void SetSourceDefaultSettings(AudioSource source, AudioType type = AudioType.Sound)
        {
            float volume = 1.0f;

            if (type == AudioType.Sound)
            {
                volume = GameSettingsPrefs.Get <float>("sound");

                source.loop = false;
            }
            else if (type == AudioType.Music)
            {
                volume = GameSettingsPrefs.Get <float>("music");

                source.loop = true;
            }

            source.clip = null;

            source.volume                = volume;
            source.pitch                 = 1.0f;
            source.spatialBlend          = 0; // 2D Sound
            source.mute                  = false;
            source.playOnAwake           = false;
            source.outputAudioMixerGroup = null;
        }
Пример #2
0
 public static float GetSoundVolume()
 {
     return(GameSettingsPrefs.Get <float>("sound"));
 }
Пример #3
0
        public static void SetSoundVolume(float volume)
        {
            GameSettingsPrefs.Set("sound", volume);

            instance.SetVolumeForAudioType(volume, AudioType.Sound);
        }
Пример #4
0
 public static float GetMusicVolume()
 {
     return(GameSettingsPrefs.Get <float>("music"));
 }
Пример #5
0
        public static void SetMusicVolume(float volume)
        {
            GameSettingsPrefs.Set("music", volume);

            instance.SetVolumeForAudioType(volume, AudioType.Music);
        }