Beispiel #1
0
    public void AddUnitInInventory(UnitDescription unit, bool addToGUINow = false)
    {
        UnitDescription equivalentUnit = GetEquivalentUnit(unit);

        if (equivalentUnit == null)
        {
            if (unitsInInventory.Count >= maxElements)
            {
                Player.instance.Wallet.Earn(ShopSystem.GetUnitSellPrice(unit));
                return;
            }

            unitsInInventory.Add(unit.GetId(), unit);

            if (addToGUINow)
            {
                inventoryUI.PutInEmptySlot(unit);
            }

            return;
        }

        equivalentUnit.EarnExperience(3);
    }