Пример #1
0
    public void UpgradePermanent(GameObject upgradeObject)
    {
        Upgrade upgrade = PermanentUpgradeManager.upgrades.First(x => x.upgradeObject == upgradeObject);

        if (GameManager.InfectedCellsCount < PermanentUpgradeManager.UpgradeCost(upgrade.stage))
        {
            return;
        }

        GameManager.InfectedCellsCount -= PermanentUpgradeManager.UpgradeCost(upgrade.stage);

        upgrade.stage++;
        _upgradesMade++;

        if (_upgradesMade >= _updatesNeededToUpdateCostMod)
        {
            _upgradesMade = 0;
            PermanentUpgradeManager.UpgradeCostMutiplier++;
            _timesIncreasedCostMultiplier++;

            if (_timesIncreasedCostMultiplier >= 6)
            {
                _updatesNeededToUpdateCostMod--;
            }
        }

        SetUpGUI(GameManager.InfectedCellsCount - PermanentUpgradeManager.UpgradeCost(upgrade.stage - 1));
    }
Пример #2
0
    void SetUpGUI(int cells)
    {
        foreach (Upgrade upgrade in PermanentUpgradeManager.upgrades)
        {
            // sets stage and price texts
            upgrade.upgradeObject.GetCompomentWithName <Text>("LevelText").text = "^" + upgrade.stage;
            upgrade.upgradeObject.GetCompomentWithName <Text>("PriceText").text = PermanentUpgradeManager.UpgradeCost(upgrade.stage) + "x";

            // sets interactibility of upgrade button
            upgrade.upgradeObject.GetComponentInChildren <Button>().interactable = PermanentUpgradeManager.UpgradeCost(upgrade.stage) <= cells;
        }

        cellsCounter.text = cells.ToString(); // sets cell counter
    }