// Allows player to pickup one item at a time. public void PickUpOne(ItemSlot itemSlot) { if (itemSlot.HasItem() && (!cursorIcon.HasItem() || itemSlot.ItemInSlot.ItemID == cursorIcon.ItemInSlot.ItemID)) { currentlyMovingItem = true; // Increase amount being moved by 1 cursorIcon.AddItems(itemSlot.ItemInSlot, 1); // Decrease items in slot by 1 itemSlot.TryRemoveItems(1); if (itemSlot.GetComponent <ResultSlot>()) { itemSlot.gameObject.GetComponent <ResultSlot>().ConsumeIngredients(); } } // Has the option to swap held item and slot item, but not part of requirement //else if (itemSlot.HasItem() && cursorIcon.HasItem() && itemSlot.canSetSlot) //{ // SwapHeldItem(itemSlot); //} }
// Allows player to drop one item into a slot. public void DropOne(ItemSlot itemSlot) { if (itemSlot.canSetSlot) { if (cursorIcon.HasItem() && (!itemSlot.HasItem() || itemSlot.ItemInSlot.ItemID == cursorIcon.ItemInSlot.ItemID)) { if (cursorIcon.TryRemoveItems(1) > 0) { itemSlot.AddItems(cursorIcon.ItemInSlot, 1); itemObject.SetActive(false); objectSpawnRadius.spawnInObject = null; } if (cursorIcon.ItemCount <= 0) { currentlyMovingItem = false; } } // Has the option to swap held item and slot item, but not part of requirement //else if (itemSlot.HasItem() && cursorIcon.HasItem() && itemSlot.canSetSlot) //{ // SwapHeldItem(itemSlot); //} } }
// Allows a player to drop all currently held items into a slot. public void DropAll(ItemSlot itemSlot) { if (itemSlot.canSetSlot) { if (cursorIcon.HasItem() && (!itemSlot.HasItem() || itemSlot.ItemInSlot.ItemID == cursorIcon.ItemInSlot.ItemID)) { if (cursorIcon.ItemCount > 0) { itemSlot.AddItems(cursorIcon.ItemInSlot, cursorIcon.ItemCount); cursorIcon.TryRemoveItems(cursorIcon.ItemCount); currentlyMovingItem = false; } } // Has the option to swap held item and slot item, but not part of requirement //else if (itemSlot.HasItem() && cursorIcon.HasItem() && itemSlot.canSetSlot) //{ // SwapHeldItem(itemSlot); //} } }