コード例 #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);
    }
コード例 #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();
    }
コード例 #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;
        }
    }
コード例 #4
0
 public void SelectHeadpat()
 {
     SelectedUpgrade = Upgrades.Upgrade.HEADPAT;
     Debug.Log("State Changed To:" + SelectedUpgrade.ToString());
 }
コード例 #5
0
 public void SelectAutoClicker()
 {
     SelectedUpgrade = Upgrades.Upgrade.AUTOCLICKER;
     Debug.Log("State Changed To:" + SelectedUpgrade.ToString());
 }