Advertisement
Guest User

swapping inventory item

a guest
Feb 11th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. //if the slot got an item
  2. else if (draggingItem.slot != slotID)
  3. {
  4. //get the slot that currently have item
  5. ItemDragHandler thisSlotItem = this.transform.GetChild(0).GetComponent<ItemDragHandler>(); //the only things in slot
  6. thisSlotItem.slot = draggingItem.slot; // 3->2 DIS
  7. thisSlotItem.transform.SetParent(inv2.slots[draggingItem.slot].transform);
  8. thisSlotItem.transform.position = inv2.slots[draggingItem.slot].transform.position;
  9.  
  10. //changing the item drag to current slot that have been pointed
  11. draggingItem.slot = slotID; // 2->3 DIS
  12. draggingItem.transform.SetParent(this.transform);
  13. draggingItem.transform.position = this.transform.position;
  14.  
  15. //zzzz the item swap wrong becoz the slot is edy change in the first place ==
  16. inv2.items[thisSlotItem.slot] = thisSlotItem.item;
  17. inv2.items[draggingItem.slot] = draggingItem.item;
  18.  
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement