public bool OnInput(InputEvent inputEvent) { if (inputEvent.IsActionPressed("MouseSecondary")) { cursor.Connect(nameof(MultiRayCursor.CursorUpdated), this, nameof(OnCursorUpdate)); clickedOffset = ToLocal(cursor.intersectionPoints[(IPickable)workspace]) - workspace.Translation; InputPriorityServer.Base.Subscribe(this, BaseRouter.dragging); trackMouse = true; return(true); } else if (inputEvent.IsActionReleased("MouseSecondary") && trackMouse) { cursor.Disconnect(nameof(MultiRayCursor.CursorUpdated), this, nameof(OnCursorUpdate)); InputPriorityServer.Base.Unsubscribe(this, BaseRouter.dragging); trackMouse = false; return(true); } return(false); }
public virtual void OnDrop() { ((Area)collider).SetCollisionLayerBit(3, true); cursor.Disconnect(nameof(MultiRayCursor.CursorUpdated), this, nameof(OnCursorUpdate)); }