private void LeftClickItemIcon(object[] eventParams)
        {
            Debug.Assert(eventParams.Length == 1 && eventParams[0] is ItemIcon);
            ItemIcon     itemIcon     = (ItemIcon)eventParams[0];
            SlotPosition slotPosition = itemIcon.Position;
            IPickupable  pickupable   = itemIcon.Item as IPickupable;
            IEquipable   equipable    = itemIcon.Item as IEquipable;

            if (_airItem.IsEmpty)
            {
                if (itemIcon.IsEquipmentIcon)
                {
                    equipable.OnUnequip(_equipment, _stats);
                }
                else if (itemIcon.Item is IStackable)
                {
                    EventManager.TriggerEvent(EventName.OPEN_SPLIT_SCREEN, eventParams);
                    return;
                }
                else
                {
                    pickupable.OnRemoveFromInventory(_inventory, slotPosition);
                }
                pickupable.OnPutInAir(_airItem, slotPosition);
            }
            else
            {
                IPickupable pickupableAir = _airItem.Item as IPickupable;
                if (slotPosition.RowIndex == EquipmentSlot.EQUIPMENT_SLOT_ROW_INDEX)
                {
                    IEquipable equipableAir = _airItem.Item as IEquipable;
                    if (equipableAir == null)
                    {
                        Debug.Log("Not equipable");
                        return;
                    }
                    if ((Equipment.EquipmentType)slotPosition.SlotIndex != equipableAir.EquipmentType)
                    {
                        Debug.Log("Not the same equipment type");
                        return;
                    }
                    if (equipable.IsDurable == false)
                    {
                        Debug.Log("Not durable");
                    }
                    equipable.OnUnequip(_equipment, _stats);
                    pickupableAir.OnRemoveFromAir(_airItem);
                    equipableAir.OnEquip(_equipment, _stats);
                    pickupable.OnPutInAir(_airItem, slotPosition);
                }
                else
                {
                    pickupable.OnRemoveFromInventory(_inventory, slotPosition);
                    pickupableAir.OnRemoveFromAir(_airItem);
                    pickupableAir.OnPutInInventory(_inventory, slotPosition);
                    pickupable.OnPutInAir(_airItem, slotPosition);
                }
            }
        }
        private void DropItem(object[] eventParams)
        {
            Debug.Assert(eventParams.Length == 1 && eventParams[0] is ItemIcon);
            ItemIcon     itemIcon     = (ItemIcon)eventParams[0];
            SlotPosition slotPosition = itemIcon.Position;
            IPickupable  pickupable   = itemIcon.Item as IPickupable;
            IEquipable   equipable    = itemIcon.Item as IEquipable;

            if (slotPosition.RowIndex == EquipmentSlot.EQUIPMENT_SLOT_ROW_INDEX)
            {
                equipable.OnUnequip(_equipment, _stats);
            }
            else
            {
                pickupable.OnRemoveFromInventory(_inventory, itemIcon.Position);
            }
            pickupable.OnPutOnGround(transform.position);
        }
        public void ConsumeItem(SlotPosition slotPosition)
        {
            Item        item       = GetItem(slotPosition);
            IPickupable pickupable = item as IPickupable;
            IStackable  stackable  = item as IStackable;

            if (stackable != null)
            {
                stackable.Count -= 1;
            }
            if (stackable == null || stackable.Count == 0)
            {
                pickupable.OnRemoveFromInventory(this, slotPosition);
            }
            UpdateCapacity();

            EventManager.TriggerEvent(EventName.UPDATE_INVENTORY);

            Debug.Log(this.ToString());
        }
        private void EquipItem(object[] eventParams)
        {
            Debug.Assert(eventParams.Length == 1 && eventParams[0] is ItemIcon);

            if (_airItem.IsEmpty == false)
            {
                Debug.Log("Air Item is not null");
                return;
            }

            ItemIcon    itemIcon   = (ItemIcon)eventParams[0];
            IPickupable pickupable = itemIcon.Item as IPickupable;
            IEquipable  equipable  = itemIcon.Item as IEquipable;

            if (equipable == null)
            {
                Debug.Log("Not equipable");
                return;
            }
            if (equipable.IsDurable == false)
            {
                Debug.Log("Not durable");
            }

            if (itemIcon.IsEquipmentIcon)
            {
                equipable.OnUnequip(_equipment, _stats);
                pickupable.OnPutInInventory(_inventory);
            }
            else
            {
                Item equippedItem = _equipment.EquipmentTable[equipable.EquipmentType].Item;
                pickupable.OnRemoveFromInventory(_inventory, itemIcon.Position);
                if (equippedItem != null)
                {
                    ((IEquipable)equippedItem).OnUnequip(_equipment, _stats);
                    ((IPickupable)equippedItem).OnPutInInventory(_inventory, itemIcon.Position);
                }
                equipable.OnEquip(_equipment, _stats);
            }
        }
        private void SplitStackableItem(object[] eventParams)
        {
            Debug.Assert(eventParams.Length == 2 && eventParams[0] is ItemIcon && eventParams[1] is int);
            ItemIcon     itemIcon     = (ItemIcon)eventParams[0];
            int          splitCount   = (int)eventParams[1];
            Item         item         = itemIcon.Item;
            SlotPosition slotPosition = itemIcon.Position;
            IStackable   stackable    = (IStackable)item;

            if (splitCount == stackable.Count)
            {
                IPickupable pickupable = (IPickupable)item;
                pickupable.OnRemoveFromInventory(_inventory, slotPosition);
                pickupable.OnPutInAir(_airItem, slotPosition);
            }
            else
            {
                Item splitItem = item.Copy();
                ((IStackable)splitItem).Count = splitCount;
                ((IPickupable)splitItem).OnPutInAir(_airItem, slotPosition);
                stackable.OnSplit(_inventory, slotPosition, splitCount);
            }
        }