public void SetOnDrag(bool drag, Collider collider, DragProcessor dragProcessor) { if (isDragging != drag) { if (drag) // Press { MyDragProcessor = dragProcessor; caller.Draggable_SetStates(ref canDrag, ref dragFrom_DragAreaIndicator); if (canDrag) { StartDragPos = MyDragProcessor.CurrentMousePosition_World; caller.Draggable_OnMouseDown(dragFrom_DragAreaIndicator, collider); isDragging = true; } else { isDragging = false; DragManager.Instance.CancelCurrentAndLastDrag(); } } else // Release { if (canDrag) { caller.Draggable_OnMouseUp(DragManager.Instance.Current_DragAreaIndicator, MyDragProcessor.CurrentMousePosition_World - StartDragPos, MyDragProcessor.DeltaMousePosition_World); DragManager.Instance.CurrentDrag = null; } else { DragManager.Instance.CurrentDrag = null; } dragFrom_DragAreaIndicator = null; isDragging = false; MyDragProcessor = null; } } }