// Update is called once per frame void Update() { if (AudioPlayer) { AudioPlayer.SetVolume(volumeSlide.value); } else { Debug.LogWarning("no music Player attached"); } if (Input.GetKeyDown(KeyCode.Escape) && flag == false) { transform.GetChild(0).gameObject.SetActive(true); Time.timeScale = 0; flag = true; } else if (Input.GetKeyDown(KeyCode.Escape) && flag == true) { transform.GetChild(0).gameObject.SetActive(false); PlayerPrefsControler.SetMasterVolume(volumeSlide.value); PlayerPrefsControler.SetDifficulty(difficultySlide.value); Time.timeScale = 1; flag = false; } }
// Start is called before the first frame update void Start() { volumeSlide.value = PlayerPrefsControler.GetVolume(); difficultySlide.value = PlayerPrefsControler.GetDifficulty(); AudioPlayer = FindObjectOfType <AudioPlayer>(); }
public void SaveAndExit() { PlayerPrefsControler.SetMasterVolume(volumeSlide.value); PlayerPrefsControler.SetDifficulty(difficultySlide.value); FindObjectOfType <LevelLoader>().LoadMainMenu(); }
void Start() { DontDestroyOnLoad(this); audioSource = GetComponent <AudioSource>(); audioSource.volume = PlayerPrefsControler.GetVolume(); }
// Update is called once per frame void Update() { lives = baseLives - PlayerPrefsControler.GetDifficulty(); livesText = GetComponent <Text>(); UpdateDisplay(); }