private static bool TryGetDebugDragable(out IDebugDragable dragable) { try { return(GameSystems.Raycaster.TryGetTarget(out dragable)); } // ReSharper disable once EmptyGeneralCatchClause catch { dragable = null; return(false); } }
public void OnRelease() { if (currentDragable == null) { return; } var mouseWorldPoint = Systems.Input.MouseWorldPoint; var targetPoint = mouseWorldPoint + offset; currentDragable.SetDebugDraggerGlobals(targetPoint, averagedVelocity); currentDragable = null; }
public void OnPress() { if (!TryGetDebugDragable(out var dragable)) { return; } currentDragable = dragable; averagedVelocity = Vector2.zero; var mouseWorldPoint = Systems.Input.MouseWorldPoint; var currentPoint = currentDragable.GetDebugDraggerPosition(); offset = currentPoint - mouseWorldPoint; currentDragable.SetDebugDraggerGlobals(currentPoint, Vector2.zero); }