public void ToggleMusic() { if (_isMusicOn) { PlayerPrefs.SetFloat(PropertiesStorage.GetMusicKey(), AUDIOOFFVALUE); _isMusicOn = false; Pause(); } else { PlayerPrefs.SetFloat(PropertiesStorage.GetMusicKey(), AUDIOONVALUE); _isMusicOn = true; FadeIn(); } PlayerPrefs.Save(); }
private void Awake() { if (musicPlayer == null) { musicPlayer = this; } else { Destroy(gameObject); } musicKey = PropertiesStorage.GetMusicKey(); soundKey = PropertiesStorage.GetSoundKey(); musicMixerParameter = PropertiesStorage.GetMusicVolumeMixerParameter(); soundMixerParameter = PropertiesStorage.GetSoundVolumeMixerParameter(); DontDestroyOnLoad(transform.gameObject); _audioSource = GetComponent <AudioSource>(); }