Пример #1
0
    public void SetVolume(float volumePercent, AudioChannel channel)
    {
        AudioSetting audioSetting = GameDataManager.instance.gameData.optionData.audioSetting;

        if (channel == AudioChannel.Master)
        {
            masterVolumePercent = volumePercent;
            audioSetting.masterVolumePercent = masterVolumePercent;
        }
        else if (channel == AudioChannel.Music)
        {
            musicVolumePercent = volumePercent;
            audioSetting.musicVolumePercent = musicVolumePercent;
        }
        else if (channel == AudioChannel.Sfx)
        {
            sfxVolumePercent = volumePercent;
            audioSetting.sfxVolumePercent = sfxVolumePercent;
        }

        musicSources[0].volume = musicVolumePercent * masterVolumePercent;
        musicSources[1].volume = musicVolumePercent * masterVolumePercent;

        audioSetting.Save();
    }
Пример #2
0
    public void SetVolume(float volumePercent, AudioChannel channel)
    {
        switch (channel)
        {
        case AudioChannel.Master:
            masterVolumePercent = volumePercent;
            break;

        case AudioChannel.Sfx:
            sfxVolumePercent = volumePercent;
            break;

        case AudioChannel.Music:
            musicVolumePercent = volumePercent;
            break;
        }

        musicSources[0].volume = musicVolumePercent * masterVolumePercent;
        musicSources[1].volume = musicVolumePercent * masterVolumePercent;

        AudioSetting audioSetting = GameDataManager.instance.gameData.optionData.audioSetting;

        audioSetting.masterVolumePercent = masterVolumePercent;
        audioSetting.musicVolumePercent  = musicVolumePercent;
        audioSetting.sfxVolumePercent    = sfxVolumePercent;

        audioSetting.Save();
    }
Пример #3
0
    public void SetVolume(float volumePercent, AudioChannel channel)
    {
        AudioSetting audioSetting = SaveDataManager.Instance.SaveData.OptionData.AudioSetting;

        if (channel == AudioChannel.Master)
        {
            MasterVolumePercent = volumePercent;
            audioSetting.MasterVolumePercent = MasterVolumePercent;
        }
        else if (channel == AudioChannel.Music)
        {
            MusicVolumePercent = volumePercent;
            audioSetting.MusicVolumePercent = MusicVolumePercent;
        }
        else if (channel == AudioChannel.Sfx)
        {
            SfxVolumePercent = volumePercent;
            audioSetting.SfxVolumePercent = SfxVolumePercent;
        }

        musicSources[0].volume = MusicVolumePercent * MasterVolumePercent;
        musicSources[1].volume = MusicVolumePercent * MasterVolumePercent;

        audioSetting.Save();
    }
Пример #4
0
 public void Save()
 {
     audioSetting.Save();
 }