public void removeGold(int removed) { TextFadeOut LooseGoldText = GameObject.Find("LooseGoldText").GetComponent <TextFadeOut>(); if (!PlayerPrefs.HasKey("Gold")) { PlayerPrefs.SetInt("Gold", 0); } gold = PlayerPrefs.GetInt("Gold"); gold -= removed; //Sauvegarde l'info PlayerPrefs.SetInt("Gold", gold); goldText.text = "Gold: " + gold; LooseGoldText.GetComponent <Text>().text = "Gold +" + removed; LooseGoldText.FadeOut(); }
public void addGold(int added) { TextFadeOut WingGoldText = GameObject.Find("WinGoldText").GetComponent <TextFadeOut>(); //Rajoute un gold if (!PlayerPrefs.HasKey("Gold")) { PlayerPrefs.SetInt("Gold", 0); } gold = PlayerPrefs.GetInt("Gold"); gold += added; //Sauvegarde l'info PlayerPrefs.SetInt("Gold", gold); goldText.text = "Gold: " + gold; WingGoldText.GetComponent <Text>().text = "Gold +" + added; WingGoldText.FadeOut(); }