Exemplo n.º 1
0
    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);
    }
Exemplo n.º 2
0
    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();
    }
Exemplo n.º 3
0
    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;
        }
    }
Exemplo n.º 4
0
 public void SelectHeadpat()
 {
     SelectedUpgrade = Upgrades.Upgrade.HEADPAT;
     Debug.Log("State Changed To:" + SelectedUpgrade.ToString());
 }
Exemplo n.º 5
0
 public void SelectAutoClicker()
 {
     SelectedUpgrade = Upgrades.Upgrade.AUTOCLICKER;
     Debug.Log("State Changed To:" + SelectedUpgrade.ToString());
 }