Пример #1
0
    public void RemoveItem(int index)
    {
        if (index < 0 || items.Count <= index)
        {
            Debug.LogWarning($"RemoveItem index {index} out of range [0,{items.Count - 1}]", this);
            return;
        }
        Armament removeItem = items[index] as Armament;

        items.RemoveAt(index);

        if (removeItem != null)
        {
            removeItem.Unequip();
        }
    }
Пример #2
0
    public void UnequipItem(EquipmentSlot fromSlot)
    {
        int      index    = (int)fromSlot;
        Armament armament = equipment[index];

        if (armament == null)
        {
            return;
        }

        armament.Unequip();
        equipment[index] = null;
        if (armament.equipmentType == EquipmentType.twoHanded)
        {
            equipment[(int)EquipmentSlot.leftHand] = equipment[(int)EquipmentSlot.rightHand] = null;
        }
    }