Пример #1
0
        private void Update()
        {
            string[] connectedJoysticks = Input.GetJoystickNames();

            ButtonType button = ButtonType.None;

            for (int a = 0; a < 9; a++)
            {
                float movement = Input.GetAxis(string.Format("Axis {0}", a));

                if (movement != 0)
                {
                    button = controllerInterface.ButtonPressed(string.Format("Axis {0}", a), movement);

                    if (button != ButtonType.None)
                    {
                        OnButtonPressed?.Invoke(button, movement);
                    }
                }
            }

            for (int b = 0; b < 11; b++)
            {
                if (Input.GetButtonUp(string.Format("Button {0}", b)))
                {
                    OnButtonPressed?.Invoke(controllerInterface.ButtonPressed(string.Format("Button {0}", b), -1), 1);
                }
            }
        }