Beispiel #1
0
    public void equipItem(EquipItem eitem)
    {
        //Debug.Log("Equipment inventory is equipping the item.");
        //make sure the item is actually in the inventory
        Item it = getItemOfType(eitem.getType());

        //does it have the item
        if (!it)
        {
            Debug.LogWarning("The inventory doesnt have this item");
            return;
        }
        //is there enough of it?
        if (it.getAmount() < 1)
        {
            Debug.LogWarning("The inventory doesnt have enough of this item");
            return;
        }
        //Is the slot for this item valid for this inventory
        List <GameTypes.EquipmentSlots> slots = eitem.getSlots();

        if (!hasSlots(slots))
        {
            Debug.LogError("The inventory doesnt have the slots for this item.");
            return;
        }
        //check if the slot is already filled
        if (slotsFilled(slots) == true)
        {
            //clear the slot of the item it contains
            clearSlots(slots);
        }
        //equip the item
        eitem.equip();
        //add the attributes to the UnitStats
        _applyEffectsToUnit(eitem);
        //add it to the map
        _fillSlots(eitem);
    }