Example #1
0
    public void UpgradeAction()
    {
        //inverse active
        active = !active;

        //perform active or inactive action
        if (active)
        {
            //check if upgrade can be bought
            if (upgrade.CanBuyUpgrade(true, ID))
            {
                //subtract gold amount, and apply upgrade
                overlord.SubtractGold(cost);
                activeAction();
            }
        }
        else
        {
            //return gold and deactivate
            overlord.AddGold(cost);
            deactiveAction();
        }
    }