private void UpdateDirectionKeys() { if (KeyboardEventHandler == null) { return; } var keyUp = false; foreach (var direction in DirectionExt.Values) { var keys = directionKeys[direction]; if (InputExt.IsAnyKeyDown(keys)) { pressedKeys.Add(direction); } else if (InputExt.IsAnyKeyUp(keys)) { pressedKeys.Remove(direction); keyUp = true; } } if (pressedKeys.Count > 0) { var movement = pressedKeys.Last; PanArgs args; if (movement == previousMovement) { args = new PanArgs(HandyDetector.Gesture.Press, PanArgs.State.Hold, Vector2.zero, Vector2.zero, Vector2.zero); } else { var delta = movement.Reverse().ToVector2(); args = new PanArgs(HandyDetector.Gesture.Press, PanArgs.State.Move, Vector2.zero, Vector2.zero, delta * 10); } KeyboardEventHandler.OnGesturePan(args); previousMovement = pressedKeys.Last; } else if (keyUp) { var args = new PanArgs(HandyDetector.Gesture.Press, PanArgs.State.Up, Vector2.zero, Vector2.zero, Vector2.zero); KeyboardEventHandler.OnGesturePan(args); previousMovement = null; } }