Exemplo n.º 1
0
        public void OnUpdate()
        {
            if (Input.GetKeyDown(KeyCode.X))
            {
                OnXButtonPressed?.Invoke();
            }

            if (Input.GetKeyDown(KeyCode.LeftArrow))
            {
                OnLeftButtonPressed?.Invoke();
            }

            if (Input.GetKeyDown(KeyCode.RightArrow))
            {
                OnRightButtonPressed?.Invoke();
            }
        }
Exemplo n.º 2
0
 //Checks the inputs and calls methods based upon the inputs. For now, depending on the scene the script has different functionality.
 //TODO: Make encountermap(_em) input like startscreen input, if you need reference check SelectButton and ClassSelectButton.
 public void UpdateInputs()
 {
     if (Input.GetKeyDown(KeyCode.LeftArrow))
     {
         OnLeftButtonPressed?.Invoke();
     }
     if (Input.GetKeyDown(KeyCode.RightArrow))
     {
         OnRightButtonPressed?.Invoke();
     }
     if (Input.GetKeyDown(KeyCode.Space))
     {
         OnSelectButtonPressed?.Invoke();
     }
     else
     {
         return;
     }
 }
Exemplo n.º 3
0
        public static void InvokeEvents()
        {
            if (OnLeftButtonDown != null && IsButtonDown(MouseButton.Left))
            {
                OnLeftButtonDown.Invoke(currentState);
            }
            if (OnLeftButtonPressed != null && IsButtonPressed(MouseButton.Left))
            {
                OnLeftButtonPressed.Invoke(currentState);
            }
            if (OnLeftButtonReleased != null && IsButtonReleased(MouseButton.Left))
            {
                OnLeftButtonReleased.Invoke(currentState);
            }

            if (OnRightButtonDown != null && IsButtonDown(MouseButton.Right))
            {
                OnRightButtonDown.Invoke(currentState);
            }
            if (OnRightButtonPressed != null && IsButtonPressed(MouseButton.Right))
            {
                OnRightButtonPressed.Invoke(currentState);
            }
            if (OnRightButtonReleased != null && IsButtonReleased(MouseButton.Right))
            {
                OnRightButtonReleased.Invoke(currentState);
            }

            if (OnMiddleButtonDown != null && IsButtonDown(MouseButton.Middle))
            {
                OnMiddleButtonDown.Invoke(currentState);
            }
            if (OnMiddleButtonPressed != null && IsButtonPressed(MouseButton.Middle))
            {
                OnMiddleButtonPressed.Invoke(currentState);
            }
            if (OnMiddleButtonReleased != null && IsButtonReleased(MouseButton.Middle))
            {
                OnMiddleButtonReleased.Invoke(currentState);
            }

            if (OnXButton1Down != null && IsButtonDown(MouseButton.XButton1))
            {
                OnXButton1Down.Invoke(currentState);
            }
            if (OnXButton1Pressed != null && IsButtonPressed(MouseButton.XButton1))
            {
                OnXButton1Pressed.Invoke(currentState);
            }
            if (OnXButton1Released != null && IsButtonReleased(MouseButton.XButton1))
            {
                OnXButton1Released.Invoke(currentState);
            }

            if (OnXButton2Down != null && IsButtonDown(MouseButton.XButton2))
            {
                OnXButton2Down.Invoke(currentState);
            }
            if (OnXButton2Pressed != null && IsButtonPressed(MouseButton.XButton2))
            {
                OnXButton2Pressed.Invoke(currentState);
            }
            if (OnXButton2Released != null && IsButtonReleased(MouseButton.XButton2))
            {
                OnXButton2Released.Invoke(currentState);
            }

            if (OnButtonDown != null && IsButtonDown(MouseButton.Any))
            {
                OnButtonDown.Invoke(currentState, GetDownButtons());
            }
            if (OnButtonPressed != null && IsButtonPressed(MouseButton.Any))
            {
                OnButtonPressed.Invoke(currentState, GetPressedButtons());
            }
            if (OnButtonReleased != null && IsButtonReleased(MouseButton.Any))
            {
                OnButtonReleased.Invoke(currentState, GetReleasedButtons());
            }

            if (OnMouseWheelUp != null && IsMouseWheelUp())
            {
                OnMouseWheelUp.Invoke(currentState);
            }
            if (OnMouseWheelDown != null && IsMouseWheelDown())
            {
                OnMouseWheelDown.Invoke(currentState);
            }

            if (OnMouseMove != null && IsMouseMoving())
            {
                OnMouseMove.Invoke(currentState, GetMoveDirection());
            }
        }
Exemplo n.º 4
0
 public void LeftButtonPressed()
 {
     OnLeftButtonPressed?.Invoke();
 }