Example #1
0
        private void UpdateButtonInput()
        {
            float value;

            for (int i = 0; i < buttonAxisInputList.Count; ++i)
            {
                ButtonAxisInput buttonAxisInput = buttonAxisInputList[i];
                value = Input.GetAxis(buttonAxisInput.axisName);
                if (value != 0.0f)
                {
                    if (value == -1.0f)
                    {
                        buttonInputFlags |= buttonAxisInput.negativeButton;
                    }
                    else if (value == 1.0f)
                    {
                        buttonInputFlags |= buttonAxisInput.positiveButton;
                    }
                }
            }

            for (int i = 0; i < buttonInputList.Count; ++i)
            {
                ButtonInput buttonInput = buttonInputList[i];
                if (UInput.GetKey(buttonInput.keyCode))
                {
                    buttonInputFlags |= buttonInput.button;
                }
            }
        }
Example #2
0
        private void AddAxisButtonInput(int joystickIndex, int axisNum, ePlayerButtonEnum negativeButtonEnum,
                                        ePlayerButtonEnum positiveButtonEnum)
        {
            ButtonAxisInput buttonAxisInput = new ButtonAxisInput();

            buttonAxisInput.negativeButton = InputSystem.GetPlayerButton(negativeButtonEnum);
            buttonAxisInput.positiveButton = InputSystem.GetPlayerButton(positiveButtonEnum);
            buttonAxisInput.axisName       = GetAxisName(joystickIndex, axisNum);
            buttonAxisInputList.Add(buttonAxisInput);
        }