示例#1
0
    public void purchaseCharacter(int index)
    {
        if (homeMan.totalCoins >= (int)homeMan.playerInfo[index]["price"])
        {
            soundMan.Play("Purchase");
            homeMan.totalCoins -= (int)homeMan.playerInfo[index]["price"];
            homeMan.playerInfo[index]["unlocked"] = true;
            homeMan.SavePlayerData();
            homeMan.SaveCoinData();

            Store.UpdateCoins();
            DisplayButtons();
        }
        else
        {
            Store.ShowSelectedPanel(2);
        }
    }
示例#2
0
    public void UpgradePurchase()
    {
        int upPrice = (int)homeMan.playerInfo[currentIndex]["upgradePrice"];

        if (homeMan.totalCoins >= upPrice)
        {
            soundMan.Play("UpgradeSound");
            int lvl = (int)homeMan.playerInfo[currentIndex]["upgradelvl"];

            homeMan.totalCoins -= upPrice;
            homeMan.playerInfo[currentIndex]["upgradePrice"] = upPrice + 500;
            homeMan.playerInfo[currentIndex]["upgradelvl"]   = lvl + 1;

            homeMan.SavePlayerData();
            homeMan.SaveCoinData();

            Store.UpdateCoins();
            ShowCharacterStats(currentIndex);
        }
        else
        {
            Store.ShowSelectedPanel(2);
        }
    }