Пример #1
0
    public static void UpgradeTower()
    {
        if (Player.SelectedUnit && Player.SelectedUnit is Tower)
        {
            Tower          selectedTower = Player.SelectedUnit as Tower;
            TowerPrototype current       = selectedTower._prototype as TowerPrototype;
            TowerPrototype upgradeTo     = current._upgradesTo;
            if (upgradeTo != null)
            {
                int price = upgradeTo._price - current._price;
                if (Player.Active.SpendGold(price))
                {
                    selectedTower.ApplyPrototype(upgradeTo);
                }
                else
                {
                    EntityManager.CreateFloatingText(selectedTower.transform.position, "Not Enough Resources", 1.0f, InputManager.TEXT_INSUFFICIENT_RESOURCES);

                    //print("Not Enough Gold");
                }
            }
        }
    }