コード例 #1
0
        private void Update()
        {
            if (!isPlayer1Input && currentState == CheckState.Player1Needed)
            {
                toolTip.text = askUserToInputString;

                if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.A))
                {
                    isPlayer1Input          = true;
                    controlIcons[0].enabled = true;
                    currentState            = CheckState.Player2Needed;
                    SaveManager.SaveArcadeControlScheme(SupportedControllers.KeyboardP2ControllerP1);
                    newScheme    = SupportedControllers.KeyboardP2ControllerP1;
                    toolTip.text = controllerSelected;
                }
                else if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8))
                {
                    isPlayer1Input          = true;
                    controlIcons[1].enabled = true;
                    currentState            = CheckState.Player2Needed;
                    SaveManager.SaveArcadeControlScheme(SupportedControllers.KeyboardP1ControllerP2);
                    newScheme    = SupportedControllers.KeyboardP1ControllerP2;
                    toolTip.text = keyboardSelected;
                }
            }

            if ((isPlayer1Input) && (currentState == CheckState.Player2Needed))
            {
                ClosePopup();
            }
        }
コード例 #2
0
        private void Control()
        {
            switch (ControllerType)
            {
            case SupportedControllers.ArcadeBoard:

                if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B7))
                {
                    ++timesPressed;
                }

                break;

            case SupportedControllers.GamePadBoth:

                if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.Return))
                {
                    ++timesPressed;
                }

                break;

            case SupportedControllers.KeyboardBoth:

                if (KeyboardControls.ButtonPress(Players.P1, Buttons.B7))
                {
                    ++timesPressed;
                }

                break;

            case SupportedControllers.KeyboardP1ControllerP2:

                if (KeyboardControls.ButtonPress(Players.P1, Buttons.B7))
                {
                    ++timesPressed;
                }

                break;

            case SupportedControllers.KeyboardP2ControllerP1:

                if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.Return))
                {
                    ++timesPressed;
                }

                break;

            default:
                break;
            }
        }
コード例 #3
0
        protected override void Update()
        {
            base.Update();

            // Controls for the player and more...
            switch (ControllerType)
            {
            case SupportedControllers.ArcadeBoard:

                if ((ArcadeControls.JoystickLeft(PlayerUsing)) && IsCooldownOver)
                {
                    MoveLR(-1);
                }
                if ((ArcadeControls.JoystickRight(PlayerUsing)) && IsCooldownOver)
                {
                    MoveLR(1);
                }
                if ((ArcadeControls.JoystickUp(PlayerUsing)) && IsCooldownOver)
                {
                    MoveUD(-1);
                }
                if ((ArcadeControls.JoystickDown(PlayerUsing)) && IsCooldownOver)
                {
                    MoveUD(1);
                }

                if (ArcadeControls.ButtonPress(PlayerUsing, Buttons.B1))
                {
                    if (InputtedValue.Length < maxLetters)
                    {
                        InputtedValue += GetChar(); UpdateInputtedText();
                    }
                }
                if (ArcadeControls.ButtonPress(PlayerUsing, Buttons.B2))
                {
                    InputtedValue = RemoveLastChar(); UpdateInputtedText();
                }

                break;

            case SupportedControllers.GamePadBoth:

                if ((ControllerControls.ControllerLeft(ConvertToPlayers(PlayerUsing))) && IsCooldownOver)
                {
                    MoveLR(-1);
                }
                if ((ControllerControls.ControllerRight(ConvertToPlayers(PlayerUsing))) && IsCooldownOver)
                {
                    MoveLR(1);
                }
                if ((ControllerControls.ControllerUp(ConvertToPlayers(PlayerUsing))) && IsCooldownOver)
                {
                    MoveUD(-1);
                }
                if ((ControllerControls.ControllerDown(ConvertToPlayers(PlayerUsing))) && IsCooldownOver)
                {
                    MoveUD(1);
                }

                if (ControllerControls.ButtonPress(ConvertToPlayers(PlayerUsing), ControllerButtons.A))
                {
                    if (InputtedValue.Length < maxLetters)
                    {
                        InputtedValue += GetChar(); UpdateInputtedText();
                    }
                }
                if (ControllerControls.ButtonPress(ConvertToPlayers(PlayerUsing), ControllerButtons.B))
                {
                    InputtedValue = RemoveLastChar(); UpdateInputtedText();
                }

                break;

            case SupportedControllers.KeyboardBoth:

                if ((KeyboardControls.KeyboardLeft(ConvertToPlayers(PlayerUsing))) && IsCooldownOver)
                {
                    MoveLR(-1);
                }
                if ((KeyboardControls.KeyboardRight(ConvertToPlayers(PlayerUsing))) && IsCooldownOver)
                {
                    MoveLR(1);
                }
                if ((KeyboardControls.KeyboardUp(ConvertToPlayers(PlayerUsing))) && IsCooldownOver)
                {
                    MoveUD(-1);
                }
                if ((KeyboardControls.KeyboardDown(ConvertToPlayers(PlayerUsing))) && IsCooldownOver)
                {
                    MoveUD(1);
                }

                if (KeyboardControls.ButtonPress(ConvertToPlayers(PlayerUsing), Buttons.B1))
                {
                    if (InputtedValue.Length < maxLetters)
                    {
                        InputtedValue += GetChar(); UpdateInputtedText();
                    }
                }
                if (KeyboardControls.ButtonPress(ConvertToPlayers(PlayerUsing), Buttons.B2))
                {
                    InputtedValue = RemoveLastChar(); UpdateInputtedText();
                }

                break;

            case SupportedControllers.KeyboardP1ControllerP2:

                if (ConvertToPlayers(PlayerUsing) == Players.P1)
                {
                    if ((KeyboardControls.KeyboardLeft(Players.P1)) && IsCooldownOver)
                    {
                        MoveLR(-1);
                    }
                    if ((KeyboardControls.KeyboardRight(Players.P1)) && IsCooldownOver)
                    {
                        MoveLR(1);
                    }
                    if ((KeyboardControls.KeyboardUp(Players.P1)) && IsCooldownOver)
                    {
                        MoveUD(-1);
                    }
                    if ((KeyboardControls.KeyboardDown(Players.P1)) && IsCooldownOver)
                    {
                        MoveUD(1);
                    }

                    if (KeyboardControls.ButtonPress(Players.P1, Buttons.B1))
                    {
                        if (InputtedValue.Length < maxLetters)
                        {
                            InputtedValue += GetChar(); UpdateInputtedText();
                        }
                    }
                    if (KeyboardControls.ButtonPress(Players.P1, Buttons.B2))
                    {
                        InputtedValue = RemoveLastChar(); UpdateInputtedText();
                    }
                }
                else
                {
                    if ((ControllerControls.ControllerLeft(Players.P1)) && IsCooldownOver)
                    {
                        MoveLR(-1);
                    }
                    if ((ControllerControls.ControllerRight(Players.P1)) && IsCooldownOver)
                    {
                        MoveLR(1);
                    }
                    if ((ControllerControls.ControllerUp(Players.P1)) && IsCooldownOver)
                    {
                        MoveUD(-1);
                    }
                    if ((ControllerControls.ControllerDown(Players.P1)) && IsCooldownOver)
                    {
                        MoveUD(1);
                    }

                    if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.A))
                    {
                        if (InputtedValue.Length < maxLetters)
                        {
                            InputtedValue += GetChar(); UpdateInputtedText();
                        }
                    }
                    if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.B))
                    {
                        InputtedValue = RemoveLastChar(); UpdateInputtedText();
                    }
                }

                break;

            case SupportedControllers.KeyboardP2ControllerP1:

                if (ConvertToPlayers(PlayerUsing) == Players.P2)
                {
                    if ((KeyboardControls.KeyboardLeft(Players.P1)) && IsCooldownOver)
                    {
                        MoveLR(-1);
                    }
                    if ((KeyboardControls.KeyboardRight(Players.P1)) && IsCooldownOver)
                    {
                        MoveLR(1);
                    }
                    if ((KeyboardControls.KeyboardUp(Players.P1)) && IsCooldownOver)
                    {
                        MoveUD(-1);
                    }
                    if ((KeyboardControls.KeyboardDown(Players.P1)) && IsCooldownOver)
                    {
                        MoveUD(1);
                    }

                    if (KeyboardControls.ButtonPress(Players.P1, Buttons.B1))
                    {
                        if (InputtedValue.Length < maxLetters)
                        {
                            InputtedValue += GetChar(); UpdateInputtedText();
                        }
                    }
                    if (KeyboardControls.ButtonPress(Players.P1, Buttons.B2))
                    {
                        InputtedValue = RemoveLastChar(); UpdateInputtedText();
                    }
                }
                else
                {
                    if ((ControllerControls.ControllerLeft(Players.P1)) && IsCooldownOver)
                    {
                        MoveLR(-1);
                    }
                    if ((ControllerControls.ControllerRight(Players.P1)) && IsCooldownOver)
                    {
                        MoveLR(1);
                    }
                    if ((ControllerControls.ControllerUp(Players.P1)) && IsCooldownOver)
                    {
                        MoveUD(-1);
                    }
                    if ((ControllerControls.ControllerDown(Players.P1)) && IsCooldownOver)
                    {
                        MoveUD(1);
                    }

                    if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.A))
                    {
                        if (InputtedValue.Length < maxLetters)
                        {
                            InputtedValue += GetChar(); UpdateInputtedText();
                        }
                    }
                    if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.B))
                    {
                        InputtedValue = RemoveLastChar(); UpdateInputtedText();
                    }
                }

                break;

            default:
                break;
            }
        }