public void music() { if (PlayerPrefs.GetInt("music") == 0) { PlayerPrefs.SetInt("music", 1); } else { PlayerPrefs.SetInt("music", 0); } pausePanel.transform.GetChild(4).GetComponent <Image>().sprite = musicImages[PlayerPrefs.GetInt("music")]; if (SceneManager.GetActiveScene().name.Equals("Farm")) { musicManager.BackgroundMusic(1); } if (SceneManager.GetActiveScene().name.Equals("Snow")) { musicManager.BackgroundMusic(2); } if (SceneManager.GetActiveScene().name.Equals("City")) { musicManager.BackgroundMusic(3); } }
public void music() { if (PlayerPrefs.GetInt("music") == 0) { musicToggle.GetComponent <Switch>().isOn = false; PlayerPrefs.SetInt("music", 1); } else { musicToggle.GetComponent <Switch>().isOn = true; PlayerPrefs.SetInt("music", 0); } musicManager.BackgroundMusic(0); }
public void musicpls() { music.BackgroundMusic(); AudioListener.volume = 1; }
public void startMenu() { musicManager.BackgroundMusic(0); GameObject.Find("Music Manager").GetComponents <AudioSource>()[2].Stop(); SceneManager.LoadScene(1); }
// Use this for initialization void Start() { isGoingDown = false; isGoingUp = false; isGoingSideWays = false; portion = (float)1 / menuCount; portion = (float)Math.Round(portion, 2); musicManager = GameObject.Find("Music Manager").GetComponent <music>(); GameObject.Find("Music Manager").GetComponent <PlayServicesMyVersion>().signIn(); //first time playing: giving the player some hearts if (PlayerPrefs.GetInt("maxHearts") == 0) { PlayerPrefs.SetInt("maxHearts", 5); PlayerPrefs.SetInt("hearts", 3); } //making sure all objects are affected and not null if (ScrollBarGameObject == null) { ScrollBarGameObject = GameObject.Find("Horizontal scrollbar"); } if (sceneContent == null) { sceneContent = GameObject.Find("Scene content"); } //reminding player of vibration (delete when finished devloping) //removing listeners to not call functions on start, then putting them back on if (PlayerPrefs.GetString("Vibration") == "True") { vibrationToggle.GetComponent <Switch>().isOn = true; } else { vibrationToggle.GetComponent <Switch>().isOn = false; } if (PlayerPrefs.GetInt("notifications") == 0) { notificationToggle.GetComponent <Switch>().isOn = true; } else { notificationToggle.GetComponent <Switch>().isOn = false; } if (PlayerPrefs.GetInt("SFX") == 0) { sfxToggle.GetComponent <Switch>().isOn = true; } else { sfxToggle.GetComponent <Switch>().isOn = false; } if (PlayerPrefs.GetInt("music") == 0) { musicToggle.GetComponent <Switch>().isOn = true; } else { musicToggle.GetComponent <Switch>().isOn = false; } //Sounds musicManager.BackgroundMusic(0); //extracting necissary elements for functions ScrollBar = ScrollBarGameObject.GetComponent <Scrollbar>(); edgeOfScreen = new Vector2(Screen.width, Screen.height); //starting boss sheep animation a second after the scene loading (explaining "1" as param) StartCoroutine(bossPopingUp(Random.Range(5, 10))); //rate us panel potentiely showing up if (PlayerPrefs.GetInt("rateUs") == 0) { int a = Random.Range(0, 20); if (a == 12) { openRateUsPanel(); } } //donate panel potentiely showing up if (PlayerPrefs.GetInt("donate") == 0 && !rateUsPanel.activeSelf) { int b = Random.Range(0, 20); if (b == 12) { openDonatePanel(); } } //giving data to texts (as late as possible) heartText.GetComponent <TextMeshProUGUI>().text = "x" + PlayerPrefs.GetInt("hearts"); moneyText.GetComponent <TextMeshProUGUI>().text = "$" + PlayerPrefs.GetInt("money"); if (PlayerPrefs.GetInt("level") > 49) { AlienButton.SetActive(false); } levelText.GetComponent <TextMeshProUGUI>().text = "Level " + (PlayerPrefs.GetInt("level") + 1); }