Implement dragging items in inventory properly

This commit is contained in:
excitedneon 2017-05-17 00:58:04 +03:00
parent 3d36d0d86d
commit bb6cbb4c4d

View File

@ -155,7 +155,6 @@ namespace Cyber.Controls {
ItemGridSelectedIndex == CurrentIndex) { ItemGridSelectedIndex == CurrentIndex) {
// This item has been selected for at least a frame, // This item has been selected for at least a frame,
// and the mouse is moving, this counts as dragging // and the mouse is moving, this counts as dragging
Debug.Log("Grabbed!");
GrabbedItem = LookedAt.collider.transform; GrabbedItem = LookedAt.collider.transform;
GrabbedItemIndex = CurrentIndex; GrabbedItemIndex = CurrentIndex;
} }
@ -193,8 +192,9 @@ namespace Cyber.Controls {
// Reset grabbing // Reset grabbing
GrabbedItem = null; GrabbedItem = null;
GrabbedItemIndex = -1; GrabbedItemIndex = -1;
ItemGridSelectedIndex = CurrentIndex;
} else { } else {
ItemGridCellMeshes[GrabbedItemIndex].transform.position = LookedAt.point;
} }
} }
} else if (Mesh != null) { } else if (Mesh != null) {