public void BuyUpgrade(string upgradeName) { int upg = PlayerPrefs.GetInt(upgradeName, 0); Upgrades.Upgrade upgrade = Upgrades.upgradeList[upg]; if (upg == 6 || int.Parse(upgrade.price) > PlayerPrefs.GetInt("money", 0)) { backButton.interactable = true; return; } confirmation.SetActive(true); }
public void ConfirmUpgrade() { string upgradeName = confirmation.name; int upg = PlayerPrefs.GetInt(upgradeName, 0); Upgrades.Upgrade upgrade = Upgrades.upgradeList[upg]; int money = PlayerPrefs.GetInt("money", 0) - int.Parse(upgrade.price); PlayerPrefs.SetInt("money", money); PlayerPrefs.SetInt(upgradeName, upg + 1); moneyText.text = money.ToString(); gameObject.GetComponent <SetIconUpgrades>().UpdateIcon(); UpdateShop(); }
void SetUpgrade(string upgradeName, Text price, List <Button> buttons) { int upg = PlayerPrefs.GetInt(upgradeName, 0); Upgrades.Upgrade upgrade = Upgrades.upgradeList[upg]; price.text = upgrade.price; for (int i = 0; i < upg; ++i) { ColorBlock colors = buttons[i].colors; colors.disabledColor = upgradedColor; buttons[i].colors = colors; } for (int i = upg; i < 6; ++i) { ColorBlock colors = buttons[i].colors; colors.disabledColor = disabledColor; buttons[i].colors = colors; } }
public void SelectHeadpat() { SelectedUpgrade = Upgrades.Upgrade.HEADPAT; Debug.Log("State Changed To:" + SelectedUpgrade.ToString()); }
public void SelectAutoClicker() { SelectedUpgrade = Upgrades.Upgrade.AUTOCLICKER; Debug.Log("State Changed To:" + SelectedUpgrade.ToString()); }