Пример #1
0
    // Update is called when Upgrade Buttons is pressed
    public void updateUpgrades(string upgradeNum)
    {
        // Use index and upgradeNum to get WoodChange
        int woodChange = upgrade1CostScript.GetUpgradeOneCost(upgradeIndex);

        // Check if purchase can be completed based on Wood Value
        if (woodUpScript.enoughWood(woodChange * -1))
        {
            // Update wood
            woodUpScript.UpdateWood(woodChange);

            // Update bool-array
            upgrade1CostScript.SetUpgradePurchased(true, upgradeIndex);

            // Apply Purchased Upgrade Effect
            applyUpgrade();
        }
    }
Пример #2
0
    //Function that finds hire method and hires
    public double findHiringMethod(string hireM)
    {
        // Ranger
        if (hireM == "Ranger" || hireM == "ranger")
        {
            double currentrangerCost = rangerCostScript.GetRangerCost();
            if (woodUpScript.enoughWood(currentrangerCost * -1))
            {
                //Update HireNum
                rangerNumScript.SetRangerNum(rangerNumScript.GetRangerNum() + 1);

                //Update New Hiring Cost
                rangerCostScript.SetRangerCost(currentrangerCost * 1.05);

                return(currentrangerCost);
            }
        }

        return(0);
    }