// Only use in Inventory private void dropItem(ItemIcon itemIcon, int itemIndex, Item currentItem) { inventoryList.Remove(currentItem); invItemIdList.Add(currentItem.getInvItemId()); ItemPrefab.instance.dropObj(currentItem.getItemType(), itemIndex); itemIcon.resetItemIcon(); }
// 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(); }
// Remove specific item public void removeItem(Item item) { int invItemId = item.getInvItemId(); InventorySlot invSlot = inventorySlotList.Find(slot => slot.itemIcon.getInvItemId() == invItemId); ItemIcon itemIcon = invSlot.itemIcon; inventoryList.Remove(item); invItemIdList.Add(invItemId); ItemPrefab.instance.destroyObj(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(); }