// DropItem Funcitons // For param@ ItemDragHandler Actions public void dropItem(ItemIcon itemIcon) { int invItemId = itemIcon.getInvItemId(); Item droppedItem = inventoryList.Find(item => item.getInvItemId() == invItemId); inventoryList.Remove(droppedItem); invItemIdList.Add(invItemId); ItemPrefab.instance.dropObj(droppedItem.getItemType(), invItemId); itemIcon.resetItemIcon(); }
public void removeCurrentItem() { ItemIcon itemIcon = inventorySlotList[currentItemNo].itemIcon; int invItemId = itemIcon.getInvItemId(); Item currentItem = inventoryList.Find(item => item.getInvItemId() == invItemId); inventoryList.Remove(currentItem); invItemIdList.Add(invItemId); ItemPrefab.instance.destroyObj(invItemId); itemIcon.resetItemIcon(); }
private void handleInventoryItem() { ItemIcon itemIcon = inventorySlotList[currentItemNo].itemIcon; if (itemIcon.getInvItemId() >= 0) { int invItemNo = itemIcon.getInvItemId(); Item currentItem = inventoryList.Find(item => item.getInvItemId() == itemIcon.getInvItemId()); ItemPrefab.instance.handleInventoryItemEvent(invItemNo); if (Input.GetKeyDown(KeyCode.G)) { dropItem(itemIcon, invItemNo, currentItem); } } else { ItemPrefab.instance.handleInventoryItemEvent(); } }