Пример #1
0
    public void ProduceUnit(unitCreation c, Owner b, bool avoid = false)
    {
        var we = new DeployementOrder(c, deplToUse.stat, deplToUse.ExtraExperience);

        if (avoid)
        {
            we = new DeployementOrder(c, new SpecialUnit.stats(), 0);
        }

        if (!GameManager.DEBUG_GODMODE)
        {
            if (!HasEnoughRessource(we, b.Inventory))
            {
                if (b.IsPlayer)
                {
                    GameManager.ShowMessage("Not enough materials for unit!");
                }
                return;
            }
        }
        b.Pay(c.unit.gameObject.GetComponent <unit>().GoldCost + we.extraGold);
        foreach (var item in we.Unit.Costs)
        {
            we.AdditionalCost.Add(item);
        }
        b.Pay(we.AdditionalCost.ToArray());

        QUI.CreateNewIcon(we);
        UnitsToDeploy.Enqueue(we);
    }