public void SaveAudioPreferences(AudioPreferences audioPreferences) { PlayerPrefs.SetFloat("MusicVolume", audioPreferences.MusicVolume); PlayerPrefs.SetFloat("SoundVolume", audioPreferences.SoundVolume); PlayerPrefs.SetInt("MuteMusic", audioPreferences.MuteMusic? 1 : 0); PlayerPrefs.SetInt("MuteSound", audioPreferences.MuteSound? 1 : 0); PlayerPrefs.Save(); }
public AudioPreferences LoadAudioPreferences() { AudioPreferences preferences = new AudioPreferences(); preferences.MusicVolume = PlayerPrefs.GetFloat("MusicVolume", 1.0f); preferences.SoundVolume = PlayerPrefs.GetFloat("SoundVolume", 1.0f); preferences.MuteMusic = (PlayerPrefs.GetInt("MuteMusic", 0) == 1); preferences.MuteSound = (PlayerPrefs.GetInt("MuteSound", 0) == 1); return(preferences); }
public void LoadSettings() { this.audioPreferences = LoadAudioPreferences(); }