private void HandleInputStandalone() { if (Input.GetKeyDown(KeyCode.Escape)) { OnEscPressed?.Invoke(this, EventArgs.Empty); } else if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter)) { OnEnterPressed?.Invoke(this, EventArgs.Empty); } else if (Input.GetKeyDown(KeyCode.Delete) || Input.GetKeyDown(KeyCode.Backspace)) { OnDeletePressed?.Invoke(this, EventArgs.Empty); } // Left Button if (Input.GetMouseButtonDown(0)) { TryToRaycast(Clickable.Click.MOUSE_LEFT_BUTTON); } // Right Button else if (Input.GetMouseButtonDown(1)) { TryToRaycast(Clickable.Click.MOUSE_RIGHT_BUTTON); } // Middle Button else if (Input.GetMouseButtonDown(2)) { TryToRaycast(Clickable.Click.MOUSE_MIDDLE_BUTTON); } /*else { * TryToRaycast(Clickable.Click.MOUSE_HOVER); * }*/ }
private static void ListenToEscapeKey() { OnEscPressed += Host_OnEscPressed; while (true) { ConsoleKey key = Console.ReadKey(true).Key; if (key == ConsoleKey.Escape) { OnEscPressed?.Invoke(null, EventArgs.Empty); } } }
private void HandleInputStandalone() { if (Input.GetKeyDown(KeyCode.Escape)) { OnEscPressed?.Invoke(this, EventArgs.Empty); } else if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter)) { OnEnterPressed?.Invoke(this, EventArgs.Empty); } else if (Input.GetKeyDown(KeyCode.Delete) || Input.GetKeyDown(KeyCode.Backspace)) { OnDeletePressed?.Invoke(this, EventArgs.Empty); } // Left Button if (Input.GetMouseButtonDown(0)) { if (TransformGizmo.Instance.mainTargetRoot != null) { if (TransformGizmo.Instance.translatingAxis == Axis.None) { TransformGizmo.Instance.ClearTargets(); TryToRaycast(Clickable.Click.MOUSE_LEFT_BUTTON); } } else { TryToRaycast(Clickable.Click.MOUSE_LEFT_BUTTON); } } // Right Button else if (Input.GetMouseButtonDown(1)) { TryToRaycast(Clickable.Click.MOUSE_RIGHT_BUTTON); } // Middle Button else if (Input.GetMouseButtonDown(2)) { TryToRaycast(Clickable.Click.MOUSE_MIDDLE_BUTTON); } else { TryToRaycast(Clickable.Click.MOUSE_HOVER); } }
public void StartListerning() { while (true) { ConsoleKeyInfo key = Console.ReadKey(true); if (key.Key.Equals(ConsoleKey.LeftArrow)) { OnLeftPressed?.Invoke(this, new EventArgs()); } if (key.Key.Equals(ConsoleKey.RightArrow)) { OnRightPressed?.Invoke(this, new EventArgs()); } if (key.Key.Equals(ConsoleKey.Spacebar)) { OnSpacePressed?.Invoke(this, new EventArgs()); } if (key.Key.Equals(ConsoleKey.R)) { OnKeyRPressed?.Invoke(this, new EventArgs()); } if (key.Key.Equals(ConsoleKey.Q)) { OnKeyQPressed?.Invoke(this, new EventArgs()); } if (key.Key.Equals(ConsoleKey.Escape)) { OnEscPressed?.Invoke(this, new EventArgs()); } } }