Beispiel #1
0
    private void ProcessControllerInput()
    {
        // Joystick enumeration index. This is a base value and should be added to (KCode + ButtonOffset) only.
        const KeyCode        KCode      = KeyCode.JoystickButton0;
        FCharacterSelectData PlayerInfo = PlayerData[FControllerIndex.XBoxController];

        // Xbox Controller: A
        if (Input.GetKeyDown(KCode))
        {
            if (!PlayerInfo.IsEnabled())
            {
                PlayerInfo.Enable();
                PlayerInfo.IsKeyboard(false);
            }
        }

        // Actions only available once the player is ready to select.
        if (PlayerInfo.IsEnabled() && !PlayerInfo.IsReady())
        {
            float AxisX = Input.GetAxis("XboxP1_DPadHorizontal");
            if (bAllowDPadInput)
            {
                if (AxisX < 0)
                {
                    PlayerInfo.PrevTexture();
                    bAllowDPadInput = false;
                }
                else if (AxisX > 0)
                {
                    PlayerInfo.NextTexture();
                    bAllowDPadInput = false;
                }
            }

            if (Input.GetKeyDown(KCode + FXboxControllerButton.Button_Start))
            {
                PlayerInfo.IsReady(true);
            }

            if (!bAllowDPadInput)
            {
                bAllowDPadInput = (AxisX == 0);
            }
        }

        if (PlayerInfo.IsReady())
        {
            if (Input.GetKeyDown(KCode + FXboxControllerButton.Button_B))
            {
                PlayerInfo.IsReady(false);
            }
        }
    }
Beispiel #2
0
    private void ProcessKeyboardInput()
    {
        FCharacterSelectData PlayerInfo = PlayerData[FControllerIndex.Keyboard];

        if (!PlayerInfo.IsEnabled())
        {
            if (Input.GetKeyDown(KeyCode.Return))
            {
                PlayerInfo.Enable();
                PlayerInfo.IsKeyboard(true);
            }
        }
        else
        {
            if (!PlayerInfo.IsReady())
            {
                if (Input.GetKeyDown(KeyCode.Return))
                {
                    PlayerInfo.IsReady(true);
                }

                if (Input.GetKeyDown(KeyCode.LeftArrow))
                {
                    PlayerInfo.PrevTexture();
                }
                else if (Input.GetKeyDown(KeyCode.RightArrow))
                {
                    PlayerInfo.NextTexture();
                }
            }
            else
            {
                if (Input.GetKeyDown(KeyCode.Return))
                {
                    PlayerInfo.IsReady(false);
                }
            }
        }
    }