/// <summary> /// Initializes the AudioChannel. Retrieves volume data from PlayerPrefs or sets it to a default value if it doesn't exist. /// </summary> /// <param name="mixer">the main Audio mixer for the game</param> internal void Initialize(AudioMixer mixer) { _mixer = mixer; if (!Prefs.HasKey(_playerPrefsKey)) { Prefs.SetFloat(_playerPrefsKey, _baseVolume); CurrentVolume = _baseVolume; } else { CurrentVolume = Prefs.GetFloat(_playerPrefsKey); } }
public void Initialize(string stageName) { _bgmResource = new Resource <AudioClip>(_bgm); playerPrefsKey = stageName + delimiter + _bgm + "_" + suffix; if (Prefs.HasKey(playerPrefsKey)) { _weight = Prefs.GetFloat(playerPrefsKey); } else { Prefs.SetFloat(playerPrefsKey, _baseWeight); _weight = _baseWeight; } }
public void Initialize(string stageName) { BGM = Resource.Get <AudioClip>(_bgm); string key = GetKey(stageName); if (Prefs.Exists(key)) { Weight = Prefs.GetFloat(key); } else { Weight = _baseWeight; Prefs.SetFloat(key, Weight); } }
public void Finish(string stageName) { Prefs.SetFloat(GetKey(stageName), Weight); }
/// <summary> /// Saves the current volume of the channel to PlayerPrefs /// </summary> internal void Save() { Prefs.SetFloat(_playerPrefsKey, _currentVolume); }
protected override void Write(float value) { Prefs.SetFloat(Key, value); }