/// <summary> /// This will load ALL saved player data into this GameController /// instance from wherver the users browsersaves data. /// </summary> protected internal void loadPreferences() { // Audio _volume = new OptionValues( (PlayerPrefs.HasKey("MasterVolume")) ? PlayerPrefs.GetFloat("MasterVolume") : 1F, (PlayerPrefs.HasKey("MusicVolume")) ? PlayerPrefs.GetFloat("MusicVolume") : 1F, (PlayerPrefs.HasKey("EffectVolume")) ? PlayerPrefs.GetFloat("EffectVolume") : 1F); _audioSource.volume = this._volume.Master; AudioListener.volume = this._volume.Music; }
void Start() { _controller = GameController.Instance; OptionValues currentValues = _controller.LoadOptions(); Debug.Log(string.Format("loaded in values {0},{1} and {2}", currentValues.Master, currentValues.Music, currentValues.Effects)); int sliderNum = 0; foreach (Slider s in volumeSliders) { s.normalizedValue = (currentValues.iterable[sliderNum] != float.NaN) ? currentValues.iterable[sliderNum] : 1F; sliderNum++; } }