Ejemplo n.º 1
0
 private void _unfillSlots(EquipItem ei)
 {
     foreach (GameTypes.EquipmentSlots es in ei.getSlots())
     {
         mSlotMap.Remove(es);
     }
 }
Ejemplo n.º 2
0
 private void _fillSlots(EquipItem ei)
 {
     foreach (GameTypes.EquipmentSlots es in ei.getSlots())
     {
         mSlotMap[es] = ei;
     }
 }
Ejemplo n.º 3
0
    public void unequipItem(EquipItem ei)
    {
        //make sure the item is actually in the inventory
        Item it = getItemOfType(ei.getType());

        //does it have the item
        if (!it)
        {
            Debug.LogWarning("The inventory doesnt have this item.");
            return;
        }
        //make sure its in there
        if (hasSlots(ei.getSlots()) == false)
        {
            Debug.LogWarning("The inventory doesnt have this item equipped.");
            return;
        }
        if (_checkSlots(ei) == false)
        {
            Debug.LogWarning("The inventory doesnt have this item equipped. Or perhaps its not in all of the necessary slots.");
            return;
        }
        ei.unequip();
        _removeEffectsFomrUnit(ei);
        _unfillSlots(ei);
    }
Ejemplo n.º 4
0
 private bool _checkSlots(EquipItem ei)
 {
     //Returns false if the item isnt in all of the slots
     foreach (GameTypes.EquipmentSlots es in ei.getSlots())
     {
         if (mSlotMap[es] != ei)
         {
             return(false);
         }
     }
     return(true);
 }
Ejemplo n.º 5
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);
    }