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(); }
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(); }
void Start() { myGuns.Add("Pistol", new Tuple <int, int>(12, 36)); myGuns.Add("AK-47", new Tuple <int, int>(30, 90)); myGuns.Add("Shotgun", new Tuple <int, int>(8, 24)); myGuns.Add("Knife", new Tuple <int, int>(0, 0)); maxMag.Add("Pistol", 12); maxMag.Add("AK-47", 30); maxMag.Add("Shotgun", 8); ammoIn = 0; ammoOut = 0; hintText = interactHint.GetComponent <TextFadeOut>(); hasKeys = false; hasGas = false; hasSteeringWheel = false; }