コード例 #1
0
        void PlayerSelectionMovement(Joysticks PlayerInput)
        {
            switch (PlayerInput)
            {
            case Joysticks.White:

                switch (ControllerType)
                {
                case SupportedControllers.ArcadeBoard:

                    if ((ArcadeControls.JoystickLeft(PlayerInput)) && (!Player1Inputted))
                    {
                        MenuAM.Play("Menu_Click", .4f);
                        --Player1Pos;
                        if (Player1Pos < 0)
                        {
                            Player1Pos = Player1MaxPos - 1;
                        }
                        StartCoroutine(InputLagP1(.2f));
                    }
                    else if ((ArcadeControls.JoystickRight(PlayerInput)) && (!Player1Inputted))
                    {
                        MenuAM.Play("Menu_Click", .4f);
                        ++Player1Pos;
                        if (Player1Pos > Player1MaxPos - 1)
                        {
                            Player1Pos = 0;
                        }
                        StartCoroutine(InputLagP1(.2f));
                    }

                    break;

                case SupportedControllers.GamePadBoth:

                    if ((ControllerControls.ControllerLeft(Players.P1)) && (!Player1Inputted))
                    {
                        MenuAM.Play("Menu_Click", .4f);
                        --Player1Pos;
                        if (Player1Pos < 0)
                        {
                            Player1Pos = Player1MaxPos - 1;
                        }
                        StartCoroutine(InputLagP1(.2f));
                    }
                    else if ((ControllerControls.ControllerRight(Players.P1)) && (!Player1Inputted))
                    {
                        MenuAM.Play("Menu_Click", .4f);
                        ++Player1Pos;
                        if (Player1Pos > Player1MaxPos - 1)
                        {
                            Player1Pos = 0;
                        }
                        StartCoroutine(InputLagP1(.2f));
                    }

                    break;

                case SupportedControllers.KeyboardBoth:

                    if ((KeyboardControls.KeyboardLeft(Players.P1)) && (!Player1Inputted))
                    {
                        MenuAM.Play("Menu_Click", .4f);
                        --Player1Pos;
                        if (Player1Pos < 0)
                        {
                            Player1Pos = Player1MaxPos - 1;
                        }
                        StartCoroutine(InputLagP1(.2f));
                    }
                    else if ((KeyboardControls.KeyboardRight(Players.P1)) && (!Player1Inputted))
                    {
                        MenuAM.Play("Menu_Click", .4f);
                        ++Player1Pos;
                        if (Player1Pos > Player1MaxPos - 1)
                        {
                            Player1Pos = 0;
                        }
                        StartCoroutine(InputLagP1(.2f));
                    }

                    break;

                case SupportedControllers.KeyboardP1ControllerP2:

                    if ((KeyboardControls.KeyboardLeft(Players.P1)) && (!Player1Inputted))
                    {
                        MenuAM.Play("Menu_Click", .4f);
                        --Player1Pos;
                        if (Player1Pos < 0)
                        {
                            Player1Pos = Player1MaxPos - 1;
                        }
                        StartCoroutine(InputLagP1(.2f));
                    }
                    else if ((KeyboardControls.KeyboardRight(Players.P1)) && (!Player1Inputted))
                    {
                        MenuAM.Play("Menu_Click", .4f);
                        ++Player1Pos;
                        if (Player1Pos > Player1MaxPos - 1)
                        {
                            Player1Pos = 0;
                        }
                        StartCoroutine(InputLagP1(.2f));
                    }

                    break;

                case SupportedControllers.KeyboardP2ControllerP1:

                    if ((ControllerControls.ControllerLeft(Players.P1)) && (!Player1Inputted))
                    {
                        MenuAM.Play("Menu_Click", .4f);
                        --Player1Pos;
                        if (Player1Pos < 0)
                        {
                            Player1Pos = Player1MaxPos - 1;
                        }
                        StartCoroutine(InputLagP1(.2f));
                    }
                    else if ((ControllerControls.ControllerRight(Players.P1)) && (!Player1Inputted))
                    {
                        MenuAM.Play("Menu_Click", .4f);
                        ++Player1Pos;
                        if (Player1Pos > Player1MaxPos - 1)
                        {
                            Player1Pos = 0;
                        }
                        StartCoroutine(InputLagP1(.2f));
                    }

                    break;

                default:
                    break;
                }

                break;

            case Joysticks.Black:

                switch (ControllerType)
                {
                case SupportedControllers.ArcadeBoard:

                    if ((ArcadeControls.JoystickLeft(PlayerInput)) && (!Player2Inputted))
                    {
                        MenuAM.Play("Menu_Click", .4f);
                        --Player2Pos;
                        if (Player2Pos < 0)
                        {
                            Player2Pos = Player2MaxPos - 1;
                        }
                        StartCoroutine(InputLagP2(.2f));
                    }
                    else if ((ArcadeControls.JoystickRight(PlayerInput)) && (!Player2Inputted))
                    {
                        MenuAM.Play("Menu_Click", .4f);
                        ++Player2Pos;
                        if (Player2Pos > Player2MaxPos - 1)
                        {
                            Player2Pos = 0;
                        }
                        StartCoroutine(InputLagP2(.2f));
                    }

                    break;

                case SupportedControllers.GamePadBoth:

                    if ((ControllerControls.ControllerLeft(Players.P2)) && (!Player2Inputted))
                    {
                        MenuAM.Play("Menu_Click", .4f);
                        --Player2Pos;
                        if (Player2Pos < 0)
                        {
                            Player2Pos = Player2MaxPos - 1;
                        }
                        StartCoroutine(InputLagP2(.2f));
                    }
                    else if ((ControllerControls.ControllerRight(Players.P2)) && (!Player2Inputted))
                    {
                        MenuAM.Play("Menu_Click", .4f);
                        ++Player2Pos;
                        if (Player2Pos > Player2MaxPos - 1)
                        {
                            Player2Pos = 0;
                        }
                        StartCoroutine(InputLagP2(.2f));
                    }

                    break;

                case SupportedControllers.KeyboardBoth:

                    if ((KeyboardControls.KeyboardLeft(Players.P2)) && (!Player2Inputted))
                    {
                        MenuAM.Play("Menu_Click", .4f);
                        --Player2Pos;
                        if (Player2Pos < 0)
                        {
                            Player2Pos = Player2MaxPos - 1;
                        }
                        StartCoroutine(InputLagP2(.2f));
                    }
                    else if ((KeyboardControls.KeyboardRight(Players.P2)) && (!Player2Inputted))
                    {
                        MenuAM.Play("Menu_Click", .4f);
                        ++Player2Pos;
                        if (Player2Pos > Player2MaxPos - 1)
                        {
                            Player2Pos = 0;
                        }
                        StartCoroutine(InputLagP2(.2f));
                    }

                    break;

                case SupportedControllers.KeyboardP1ControllerP2:

                    if ((ControllerControls.ControllerLeft(Players.P1)) && (!Player2Inputted))
                    {
                        MenuAM.Play("Menu_Click", .4f);
                        --Player2Pos;
                        if (Player2Pos < 0)
                        {
                            Player2Pos = Player2MaxPos - 1;
                        }
                        StartCoroutine(InputLagP2(.2f));
                    }
                    else if ((ControllerControls.ControllerRight(Players.P1)) && (!Player2Inputted))
                    {
                        MenuAM.Play("Menu_Click", .4f);
                        ++Player2Pos;
                        if (Player2Pos > Player2MaxPos - 1)
                        {
                            Player2Pos = 0;
                        }
                        StartCoroutine(InputLagP2(.2f));
                    }

                    break;

                case SupportedControllers.KeyboardP2ControllerP1:

                    if ((KeyboardControls.KeyboardLeft(Players.P1)) && (!Player2Inputted))
                    {
                        MenuAM.Play("Menu_Click", .4f);
                        --Player2Pos;
                        if (Player2Pos < 0)
                        {
                            Player2Pos = Player2MaxPos - 1;
                        }
                        StartCoroutine(InputLagP2(.2f));
                    }
                    else if ((KeyboardControls.KeyboardRight(Players.P1)) && (!Player2Inputted))
                    {
                        MenuAM.Play("Menu_Click", .4f);
                        ++Player2Pos;
                        if (Player2Pos > Player2MaxPos - 1)
                        {
                            Player2Pos = 0;
                        }
                        StartCoroutine(InputLagP2(.2f));
                    }

                    break;

                default:
                    break;
                }

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

            UpdateDisplay();

            switch (ControllerType)
            {
            case SupportedControllers.ArcadeBoard:

                if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B8))
                {
                    SetNumberofRounds(Selection);
                    am.Play("Menu-Confirm", .25f);
                    OpenCustomMenu();
                }

                if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B7))
                {
                    am.Play("Confirm", .25f);
                    BackToRootMenu();
                }

                if (ArcadeControls.JoystickLeft(Joysticks.White) && !IsCoR)
                {
                    StartCoroutine(RoundsSelect(-1));
                }
                if (ArcadeControls.JoystickRight(Joysticks.White) && !IsCoR)
                {
                    StartCoroutine(RoundsSelect(1));
                }

                break;

            case SupportedControllers.GamePadBoth:

                if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.A))
                {
                    SetNumberofRounds(Selection);
                    am.Play("Menu-Confirm", .25f);
                    OpenCustomMenu();
                }

                if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.B))
                {
                    am.Play("Confirm", .25f);
                    BackToRootMenu();
                }

                if (ControllerControls.ControllerLeft(Players.P1) && !IsCoR)
                {
                    StartCoroutine(RoundsSelect(-1));
                }
                if (ControllerControls.ControllerRight(Players.P1) && !IsCoR)
                {
                    StartCoroutine(RoundsSelect(1));
                }

                break;

            case SupportedControllers.KeyboardBoth:

                if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8))
                {
                    SetNumberofRounds(Selection);
                    am.Play("Menu-Confirm", .25f);
                    OpenCustomMenu();
                }

                if (KeyboardControls.ButtonPress(Players.P1, Buttons.B7))
                {
                    am.Play("Confirm", .25f);
                    BackToRootMenu();
                }

                if (KeyboardControls.KeyboardLeft(Players.P1) && !IsCoR)
                {
                    StartCoroutine(RoundsSelect(-1));
                }
                if (KeyboardControls.KeyboardRight(Players.P1) && !IsCoR)
                {
                    StartCoroutine(RoundsSelect(1));
                }

                break;

            case SupportedControllers.KeyboardP1ControllerP2:

                if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8))
                {
                    SetNumberofRounds(Selection);
                    am.Play("Menu-Confirm", .25f);
                    OpenCustomMenu();
                }

                if (KeyboardControls.ButtonPress(Players.P1, Buttons.B7))
                {
                    am.Play("Confirm", .25f);
                    BackToRootMenu();
                }

                if (KeyboardControls.KeyboardLeft(Players.P1) && !IsCoR)
                {
                    StartCoroutine(RoundsSelect(-1));
                }
                if (KeyboardControls.KeyboardRight(Players.P1) && !IsCoR)
                {
                    StartCoroutine(RoundsSelect(1));
                }

                break;

            case SupportedControllers.KeyboardP2ControllerP1:

                if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.A))
                {
                    SetNumberofRounds(Selection);
                    am.Play("Menu-Confirm", .25f);
                    OpenCustomMenu();
                }

                if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.B))
                {
                    am.Play("Confirm", .25f);
                    BackToRootMenu();
                }

                if (ControllerControls.ControllerLeft(Players.P1) && !IsCoR)
                {
                    StartCoroutine(RoundsSelect(-1));
                }
                if (ControllerControls.ControllerRight(Players.P1) && !IsCoR)
                {
                    StartCoroutine(RoundsSelect(1));
                }

                break;

            default:
                break;
            }
        }
コード例 #3
0
        private void RotatePlayer()
        {
            switch (ControllerType)
            {
            case SupportedControllers.ArcadeBoard:

                switch (Ducks)
                {
                case DuckPlayers.P1:

                    if (ArcadeControls.JoystickLeft(Joysticks.White))
                    {
                        transform.localEulerAngles += new Vector3(0, -1 * RotSpd, 0);
                    }
                    else if (ArcadeControls.JoystickRight(Joysticks.White))
                    {
                        transform.localEulerAngles += new Vector3(0, 1 * RotSpd, 0);
                    }

                    break;

                case DuckPlayers.P2:

                    if (ArcadeControls.JoystickLeft(Joysticks.Black))
                    {
                        transform.localEulerAngles += new Vector3(0, -1 * RotSpd, 0);
                    }
                    else if (ArcadeControls.JoystickRight(Joysticks.Black))
                    {
                        transform.localEulerAngles += new Vector3(0, 1 * RotSpd, 0);
                    }

                    break;
                }

                break;

            case SupportedControllers.GamePadBoth:

                switch (Ducks)
                {
                case DuckPlayers.P1:

                    if (ControllerControls.ControllerLeft(Players.P1))
                    {
                        transform.localEulerAngles += new Vector3(0, -1 * RotSpd, 0);
                    }
                    else if (ControllerControls.ControllerRight(Players.P1))
                    {
                        transform.localEulerAngles += new Vector3(0, 1 * RotSpd, 0);
                    }

                    break;

                case DuckPlayers.P2:

                    if (ControllerControls.ControllerLeft(Players.P2))
                    {
                        transform.localEulerAngles += new Vector3(0, -1 * RotSpd, 0);
                    }
                    else if (ControllerControls.ControllerRight(Players.P2))
                    {
                        transform.localEulerAngles += new Vector3(0, 1 * RotSpd, 0);
                    }

                    break;
                }

                break;

            case SupportedControllers.KeyboardBoth:

                switch (Ducks)
                {
                case DuckPlayers.P1:

                    if (KeyboardControls.KeyboardLeft(Players.P1))
                    {
                        transform.localEulerAngles += new Vector3(0, -1 * RotSpd, 0);
                    }
                    else if (KeyboardControls.KeyboardRight(Players.P1))
                    {
                        transform.localEulerAngles += new Vector3(0, 1 * RotSpd, 0);
                    }

                    break;

                case DuckPlayers.P2:

                    if (KeyboardControls.KeyboardLeft(Players.P2))
                    {
                        transform.localEulerAngles += new Vector3(0, -1 * RotSpd, 0);
                    }
                    else if (KeyboardControls.KeyboardRight(Players.P2))
                    {
                        transform.localEulerAngles += new Vector3(0, 1 * RotSpd, 0);
                    }

                    break;
                }

                break;

            case SupportedControllers.KeyboardP1ControllerP2:

                switch (Ducks)
                {
                case DuckPlayers.P1:

                    if (KeyboardControls.KeyboardLeft(Players.P1))
                    {
                        transform.localEulerAngles += new Vector3(0, -1 * RotSpd, 0);
                    }
                    else if (KeyboardControls.KeyboardRight(Players.P1))
                    {
                        transform.localEulerAngles += new Vector3(0, 1 * RotSpd, 0);
                    }

                    break;

                case DuckPlayers.P2:

                    if (ControllerControls.ControllerLeft(Players.P1))
                    {
                        transform.localEulerAngles += new Vector3(0, -1 * RotSpd, 0);
                    }
                    else if (ControllerControls.ControllerRight(Players.P1))
                    {
                        transform.localEulerAngles += new Vector3(0, 1 * RotSpd, 0);
                    }

                    break;
                }

                break;

            case SupportedControllers.KeyboardP2ControllerP1:

                switch (Ducks)
                {
                case DuckPlayers.P2:

                    if (KeyboardControls.KeyboardLeft(Players.P1))
                    {
                        transform.localEulerAngles += new Vector3(0, -1 * RotSpd, 0);
                    }
                    else if (KeyboardControls.KeyboardRight(Players.P1))
                    {
                        transform.localEulerAngles += new Vector3(0, 1 * RotSpd, 0);
                    }

                    break;

                case DuckPlayers.P1:

                    if (ControllerControls.ControllerLeft(Players.P1))
                    {
                        transform.localEulerAngles += new Vector3(0, -1 * 3, 0);
                    }
                    else if (ControllerControls.ControllerRight(Players.P1))
                    {
                        transform.localEulerAngles += new Vector3(0, 1 * 3, 0);
                    }

                    break;
                }

                break;

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

            if (ScriptEnabled)
            {
                // Root Menu With Buttons
                if (!IsReplay)
                {
                    Debug.Log("hi>");

                    if (Confirm())
                    {
                        switch (pos)
                        {
                        case 0:
                            Rematch();
                            break;

                        case 1:
                            ReplaySelected();
                            break;

                        case 2:
                            ReturnToMenu();
                            break;

                        default:
                            break;
                        }
                    }

                    if (ValueChanged())
                    {
                        UpdateDisplay();
                    }

                    MoveLR();
                }
                else if ((IsReplay) && (!ReplayOptionSelected))
                {
                    MoveUD();

                    if (ValueChanged())
                    {
                        UpdateReplayDisplay();
                    }
                    Debug.Log("hi>>");

                    if (Confirm() && !IsCoR)
                    {
                        switch (pos)
                        {
                        case 0:
                            SelectedGamemode = Gamemodes.Lives;
                            IncrementAmount  = 1;
                            Value            = 5;
                            minValue         = Value;
                            UpdateTextValue();
                            break;

                        case 1:
                            SelectedGamemode = Gamemodes.Timer;
                            IncrementAmount  = 15;
                            Value            = 60;
                            minValue         = Value;
                            UpdateTextValue();
                            break;

                        case 2:
                            SelectedGamemode = Gamemodes.SetScore;
                            IncrementAmount  = 1000;
                            Value            = 1000;
                            minValue         = Value;
                            UpdateTextValue();
                            break;

                        default:
                            break;
                        }

                        ReplayOptionSelected = true;
                    }
                    else if (Return() && !IsCoR)
                    {
                        pos      = 1;
                        IsReplay = false;
                        StartCoroutine(InputDelay());
                    }
                }
                else if ((IsReplay) && (ReplayOptionSelected))
                {
                    Debug.Log("hi>>>");
                    if (Confirm() && !IsCoR)
                    {
                        SaveManager.SaveUltimatePinballGamemode((int)SelectedGamemode, IncrementAmount, Value);
                        StartCoroutine(LoadReplay());
                    }
                    else if (Return() && !IsCoR)
                    {
                        ReplayOptionSelected = false;
                        StartCoroutine(InputDelay());
                    }
                }
                else
                {
                    Debug.Log("hi");
                }
            }



            if (IsReplay && ReplayCanvas.alpha != 1)
            {
                ReplayCanvas.alpha += Time.deltaTime * 2;
            }
            else if (!IsReplay && ReplayCanvas.alpha != 0)
            {
                ReplayCanvas.alpha -= Time.deltaTime * 2;
            }

            // Updates the amount needed text and revials it
            if (IsReplay && ReplayOptionSelected && SelectedGamemode != Gamemodes.None)
            {
                if (ReplayValueCanvas.alpha != 1)
                {
                    ReplayValueCanvas.alpha += Time.deltaTime * 2;
                }

                switch (ControllerType)
                {
                case SupportedControllers.ArcadeBoard:

                    if ((ArcadeControls.JoystickLeft(Joysticks.White) && (!IsCoR)))
                    {
                        if (Value != minValue)
                        {
                            Value -= IncrementAmount;
                        }
                        StartCoroutine(InputDelay());
                        UpdateTextValue();
                    }
                    if ((ArcadeControls.JoystickRight(Joysticks.White) && (!IsCoR)))
                    {
                        Value += IncrementAmount;
                        StartCoroutine(InputDelay());
                        UpdateTextValue();
                    }

                    break;

                case SupportedControllers.GamePadBoth:

                    if ((ControllerControls.ControllerLeft(Players.P1) && (!IsCoR)))
                    {
                        if (Value != minValue)
                        {
                            Value -= IncrementAmount;
                        }
                        StartCoroutine(InputDelay());
                        UpdateTextValue();
                    }
                    if ((ControllerControls.ControllerRight(Players.P1) && (!IsCoR)))
                    {
                        Value += IncrementAmount;
                        StartCoroutine(InputDelay());
                        UpdateTextValue();
                    }

                    break;

                case SupportedControllers.KeyboardBoth:

                    if ((KeyboardControls.KeyboardLeft(Players.P1) && (!IsCoR)))
                    {
                        if (Value != minValue)
                        {
                            Value -= IncrementAmount;
                        }
                        StartCoroutine(InputDelay());
                        UpdateTextValue();
                    }
                    if ((KeyboardControls.KeyboardRight(Players.P1) && (!IsCoR)))
                    {
                        Value += IncrementAmount;
                        StartCoroutine(InputDelay());
                        UpdateTextValue();
                    }

                    break;

                case SupportedControllers.KeyboardP1ControllerP2:

                    if ((KeyboardControls.KeyboardLeft(Players.P1) && (!IsCoR)))
                    {
                        if (Value != minValue)
                        {
                            Value -= IncrementAmount;
                        }
                        StartCoroutine(InputDelay());
                        UpdateTextValue();
                    }
                    if ((KeyboardControls.KeyboardRight(Players.P1) && (!IsCoR)))
                    {
                        Value += IncrementAmount;
                        StartCoroutine(InputDelay());
                        UpdateTextValue();
                    }

                    break;

                case SupportedControllers.KeyboardP2ControllerP1:

                    if ((ControllerControls.ControllerLeft(Players.P1) && (!IsCoR)))
                    {
                        if (Value != minValue)
                        {
                            Value -= IncrementAmount;
                        }
                        StartCoroutine(InputDelay());
                        UpdateTextValue();
                    }
                    if ((ControllerControls.ControllerRight(Players.P1) && (!IsCoR)))
                    {
                        Value += IncrementAmount;
                        StartCoroutine(InputDelay());
                        UpdateTextValue();
                    }

                    break;

                default:
                    break;
                }
            }
            else if (IsReplay && !ReplayOptionSelected && ReplayValueCanvas.alpha != 0)
            {
                ReplayValueCanvas.alpha -= Time.deltaTime * 2;
            }
        }
コード例 #5
0
        /// <summary>
        /// Allow the player to move around in the scene
        /// </summary>
        void PlayerMovement()
        {
            switch (ControllerType)
            {
            case SupportedControllers.ArcadeBoard:

                if (ArcadeControls.JoystickLeft(Player))
                {
                    RB.velocity = Vector2.left * MoveSpd * Time.deltaTime;
                    UpdateGunshipDirection(Vector2.left);
                }

                if (ArcadeControls.JoystickRight(Player))
                {
                    RB.velocity = Vector2.right * MoveSpd * Time.deltaTime;
                    UpdateGunshipDirection(Vector2.right);
                }

                if (ArcadeControls.JoystickUp(Player))
                {
                    RB.velocity = Vector2.up * MoveSpd * Time.deltaTime;
                    //UpdateGunshipDirection(Vector2.up);
                }

                if (ArcadeControls.JoystickDown(Player))
                {
                    RB.velocity = Vector2.down * MoveSpd * Time.deltaTime;
                    //UpdateGunshipDirection(Vector2.down);
                }

                if (ArcadeControls.JoystickNorthEast(Player))
                {
                    RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f) * MoveSpd * Time.deltaTime;
                    UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f));
                }

                if (ArcadeControls.JoystickNorthWest(Player))
                {
                    RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f) * MoveSpd * Time.deltaTime;
                    UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f));
                }

                if (ArcadeControls.JoystickSouthEast(Player))
                {
                    RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f) * MoveSpd * Time.deltaTime;
                    UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f));
                }

                if (ArcadeControls.JoystickSouthWest(Player))
                {
                    RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f) * MoveSpd * Time.deltaTime;
                    UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f));
                }

                if (ArcadeControls.JoystickNone(Player))
                {
                    RB.velocity = Vector2.zero;
                }

                break;

            case SupportedControllers.GamePadBoth:

                if (ControllerControls.ControllerLeft(ConvertToPlayers()))
                {
                    RB.velocity = Vector2.left * MoveSpd * Time.deltaTime;
                    UpdateGunshipDirection(Vector2.left);
                }

                if (ControllerControls.ControllerRight(ConvertToPlayers()))
                {
                    RB.velocity = Vector2.right * MoveSpd * Time.deltaTime;
                    UpdateGunshipDirection(Vector2.right);
                }

                if (ControllerControls.ControllerUp(ConvertToPlayers()))
                {
                    RB.velocity = Vector2.up * MoveSpd * Time.deltaTime;
                    //UpdateGunshipDirection(Vector2.up);
                }

                if (ControllerControls.ControllerDown(ConvertToPlayers()))
                {
                    RB.velocity = Vector2.down * MoveSpd * Time.deltaTime;
                    //UpdateGunshipDirection(Vector2.down);
                }

                if (ControllerControls.ControllerLeftUp(ConvertToPlayers()))
                {
                    RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f) * MoveSpd * Time.deltaTime;
                    UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f));
                }

                if (ControllerControls.ControllerRightUp(ConvertToPlayers()))
                {
                    RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f) * MoveSpd * Time.deltaTime;
                    UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f));
                }

                if (ControllerControls.ControllerLeftDown(ConvertToPlayers()))
                {
                    RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f) * MoveSpd * Time.deltaTime;
                    UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f));
                }

                if (ControllerControls.ControllerRightDown(ConvertToPlayers()))
                {
                    RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f) * MoveSpd * Time.deltaTime;
                    UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f));
                }

                if (ControllerControls.ControllerNone(ConvertToPlayers()))
                {
                    RB.velocity = Vector2.zero;
                }

                break;

            case SupportedControllers.KeyboardBoth:

                if (KeyboardControls.KeyboardLeft(ConvertToPlayers()))
                {
                    RB.velocity = Vector2.left * MoveSpd * Time.deltaTime;
                    UpdateGunshipDirection(Vector2.left);
                }
                if (KeyboardControls.KeyboardRight(ConvertToPlayers()))
                {
                    RB.velocity = Vector2.right * MoveSpd * Time.deltaTime;
                    UpdateGunshipDirection(Vector2.right);
                }
                if (KeyboardControls.KeyboardUp(ConvertToPlayers()))
                {
                    RB.velocity = Vector2.up * MoveSpd * Time.deltaTime;
                    // UpdateGunshipDirection(Vector2.up);
                }
                if (KeyboardControls.KeyboardDown(ConvertToPlayers()))
                {
                    RB.velocity = Vector2.down * MoveSpd * Time.deltaTime;
                    //UpdateGunshipDirection(Vector2.down);
                }
                if (KeyboardControls.KeyboardLeftUp(ConvertToPlayers()))
                {
                    RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f) * MoveSpd * Time.deltaTime;
                    UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f));
                }
                if (KeyboardControls.KeyboardRightUp(ConvertToPlayers()))
                {
                    RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f) * MoveSpd * Time.deltaTime;
                    UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f));
                }
                if (KeyboardControls.KeyboardLeftDown(ConvertToPlayers()))
                {
                    RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f) * MoveSpd * Time.deltaTime;
                    UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f));
                }
                if (KeyboardControls.KeyboardRightDown(ConvertToPlayers()))
                {
                    RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f) * MoveSpd * Time.deltaTime;
                    UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f));
                }
                if (KeyboardControls.KeyboardNone(ConvertToPlayers()))
                {
                    RB.velocity = Vector2.zero;
                }

                break;

            case SupportedControllers.KeyboardP1ControllerP2:

                if (ConvertToPlayers() == Players.P1)
                {
                    if (KeyboardControls.KeyboardLeft(Players.P1))
                    {
                        RB.velocity = Vector2.left * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.left);
                    }
                    if (KeyboardControls.KeyboardRight(Players.P1))
                    {
                        RB.velocity = Vector2.right * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.right);
                    }
                    if (KeyboardControls.KeyboardUp(Players.P1))
                    {
                        RB.velocity = Vector2.up * MoveSpd * Time.deltaTime;
                        //UpdateGunshipDirection(Vector2.up);
                    }
                    if (KeyboardControls.KeyboardDown(Players.P1))
                    {
                        RB.velocity = Vector2.down * MoveSpd * Time.deltaTime;
                        //UpdateGunshipDirection(Vector2.down);
                    }
                    if (KeyboardControls.KeyboardLeftUp(Players.P1))
                    {
                        RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f) * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f));
                    }
                    if (KeyboardControls.KeyboardRightUp(Players.P1))
                    {
                        RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f) * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f));
                    }
                    if (KeyboardControls.KeyboardLeftDown(Players.P1))
                    {
                        RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f) * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f));
                    }
                    if (KeyboardControls.KeyboardRightDown(Players.P1))
                    {
                        RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f) * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f));
                    }
                    if (KeyboardControls.KeyboardNone(Players.P1))
                    {
                        RB.velocity = Vector2.zero;
                    }
                }
                else
                {
                    if (ControllerControls.ControllerLeft(Players.P1))
                    {
                        RB.velocity = Vector2.left * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.left);
                    }

                    if (ControllerControls.ControllerRight(Players.P1))
                    {
                        RB.velocity = Vector2.right * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.right);
                    }

                    if (ControllerControls.ControllerUp(Players.P1))
                    {
                        RB.velocity = Vector2.up * MoveSpd * Time.deltaTime;
                        //UpdateGunshipDirection(Vector2.up);
                    }

                    if (ControllerControls.ControllerDown(Players.P1))
                    {
                        RB.velocity = Vector2.down * MoveSpd * Time.deltaTime;
                        //UpdateGunshipDirection(Vector2.down);
                    }

                    if (ControllerControls.ControllerLeftUp(Players.P1))
                    {
                        RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f) * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f));
                    }

                    if (ControllerControls.ControllerRightUp(Players.P1))
                    {
                        RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f) * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f));
                    }

                    if (ControllerControls.ControllerLeftDown(Players.P1))
                    {
                        RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f) * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f));
                    }

                    if (ControllerControls.ControllerRightDown(Players.P1))
                    {
                        RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f) * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f));
                    }

                    if (ControllerControls.ControllerNone(Players.P1))
                    {
                        RB.velocity = Vector2.zero;
                    }
                }

                break;

            case SupportedControllers.KeyboardP2ControllerP1:

                if (ConvertToPlayers() == Players.P2)
                {
                    if (KeyboardControls.KeyboardLeft(Players.P1))
                    {
                        RB.velocity = Vector2.left * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.left);
                    }
                    if (KeyboardControls.KeyboardRight(Players.P1))
                    {
                        RB.velocity = Vector2.right * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.right);
                    }
                    if (KeyboardControls.KeyboardUp(Players.P1))
                    {
                        RB.velocity = Vector2.up * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.up);
                    }
                    if (KeyboardControls.KeyboardDown(Players.P1))
                    {
                        RB.velocity = Vector2.down * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.down);
                    }
                    if (KeyboardControls.KeyboardLeftUp(Players.P1))
                    {
                        RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f) * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f));
                    }
                    if (KeyboardControls.KeyboardRightUp(Players.P1))
                    {
                        RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f) * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f));
                    }
                    if (KeyboardControls.KeyboardLeftDown(Players.P1))
                    {
                        RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f) * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f));
                    }
                    if (KeyboardControls.KeyboardRightDown(Players.P1))
                    {
                        RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f) * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f));
                    }
                    if (KeyboardControls.KeyboardNone(Players.P1))
                    {
                        RB.velocity = Vector2.zero;
                    }
                }
                else
                {
                    if (ControllerControls.ControllerLeft(Players.P1))
                    {
                        RB.velocity = Vector2.left * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.left);
                    }

                    if (ControllerControls.ControllerRight(Players.P1))
                    {
                        RB.velocity = Vector2.right * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.right);
                    }

                    if (ControllerControls.ControllerUp(Players.P1))
                    {
                        RB.velocity = Vector2.up * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.up);
                    }

                    if (ControllerControls.ControllerDown(Players.P1))
                    {
                        RB.velocity = Vector2.down * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.down);
                    }

                    if (ControllerControls.ControllerLeftUp(Players.P1))
                    {
                        RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f) * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.right, 1f));
                    }

                    if (ControllerControls.ControllerRightUp(Players.P1))
                    {
                        RB.velocity = Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f) * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.up + Vector2.left, 1f));
                    }

                    if (ControllerControls.ControllerLeftDown(Players.P1))
                    {
                        RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f) * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.right, 1f));
                    }

                    if (ControllerControls.ControllerRightDown(Players.P1))
                    {
                        RB.velocity = Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f) * MoveSpd * Time.deltaTime;
                        UpdateGunshipDirection(Vector2.ClampMagnitude(Vector2.down + Vector2.left, 1f));
                    }

                    if (ControllerControls.ControllerNone(Players.P1))
                    {
                        RB.velocity = Vector2.zero;
                    }
                }

                break;

            default:
                break;
            }
        }
コード例 #6
0
        public int GetLRDir()
        {
            switch (ControllerType)
            {
            case SupportedControllers.ArcadeBoard:

                if ((ArcadeControls.JoystickLeft(Joysticks.White)) && (!isCoR))
                {
                    return(-1);
                }
                if ((ArcadeControls.JoystickRight(Joysticks.White)) && (!isCoR))
                {
                    return(1);
                }
                else
                {
                    return(0);
                }

            case SupportedControllers.GamePadBoth:

                if ((ControllerControls.ControllerLeft(Players.P1)) && (!isCoR))
                {
                    return(-1);
                }
                if ((ControllerControls.ControllerRight(Players.P1)) && (!isCoR))
                {
                    return(1);
                }
                else
                {
                    return(0);
                }

            case SupportedControllers.KeyboardBoth:

                if ((KeyboardControls.KeyboardLeft(Players.P1)) && (!isCoR))
                {
                    return(-1);
                }
                if ((KeyboardControls.KeyboardRight(Players.P1)) && (!isCoR))
                {
                    return(1);
                }
                else
                {
                    return(0);
                }

            case SupportedControllers.KeyboardP1ControllerP2:

                if ((KeyboardControls.KeyboardLeft(Players.P1)) && (!isCoR))
                {
                    return(-1);
                }
                if ((KeyboardControls.KeyboardRight(Players.P1)) && (!isCoR))
                {
                    return(1);
                }
                else
                {
                    return(0);
                }

            case SupportedControllers.KeyboardP2ControllerP1:

                if ((ControllerControls.ControllerLeft(Players.P1)) && (!isCoR))
                {
                    return(-1);
                }
                if ((ControllerControls.ControllerRight(Players.P1)) && (!isCoR))
                {
                    return(1);
                }
                else
                {
                    return(0);
                }

            default:
                return(0);
            }
        }
コード例 #7
0
        public void MoveLR()
        {
            switch (ControllerType)
            {
            case SupportedControllers.ArcadeBoard:

                if ((ArcadeControls.JoystickLeft(Joysticks.White)) && (!isCoR))
                {
                    StartCoroutine(MoveAround(-1));
                }
                if ((ArcadeControls.JoystickRight(Joysticks.White)) && (!isCoR))
                {
                    StartCoroutine(MoveAround(1));
                }

                break;

            case SupportedControllers.GamePadBoth:

                if ((ControllerControls.ControllerLeft(Players.P1)) && (!isCoR))
                {
                    StartCoroutine(MoveAround(-1));
                }
                if ((ControllerControls.ControllerRight(Players.P1)) && (!isCoR))
                {
                    StartCoroutine(MoveAround(1));
                }

                break;

            case SupportedControllers.KeyboardBoth:

                if ((KeyboardControls.KeyboardLeft(Players.P1)) && (!isCoR))
                {
                    StartCoroutine(MoveAround(-1));
                }
                if ((KeyboardControls.KeyboardRight(Players.P1)) && (!isCoR))
                {
                    StartCoroutine(MoveAround(1));
                }

                break;

            case SupportedControllers.KeyboardP1ControllerP2:

                if ((KeyboardControls.KeyboardLeft(Players.P1)) && (!isCoR))
                {
                    StartCoroutine(MoveAround(-1));
                }
                if ((KeyboardControls.KeyboardRight(Players.P1)) && (!isCoR))
                {
                    StartCoroutine(MoveAround(1));
                }

                break;

            case SupportedControllers.KeyboardP2ControllerP1:

                if ((ControllerControls.ControllerLeft(Players.P1)) && (!isCoR))
                {
                    StartCoroutine(MoveAround(-1));
                }
                if ((ControllerControls.ControllerRight(Players.P1)) && (!isCoR))
                {
                    StartCoroutine(MoveAround(1));
                }

                break;

            default:
                break;
            }
        }
コード例 #8
0
        private void FixedUpdate()
        {
            // Switches the flippers between left and right
            switch (ThisFlipper)
            {
            case FlipperSides.Left:

                switch (ControllerType)
                {
                case SupportedControllers.ArcadeBoard:

                    if (ArcadeControls.JoystickLeft(Input))
                    {
                        FlipLeftFlipper();
                    }
                    else if (ArcadeControls.JoystickNone(Input))
                    {
                        ResetLeftFlipper();
                    }

                    break;

                case SupportedControllers.GamePadBoth:

                    if (ControllerControls.ControllerLeft(ConvertToPlayers()))
                    {
                        FlipLeftFlipper();
                    }
                    else if (ControllerControls.ControllerNone(ConvertToPlayers()))
                    {
                        ResetLeftFlipper();
                    }

                    break;

                case SupportedControllers.KeyboardBoth:

                    if (KeyboardControls.KeyboardLeft(ConvertToPlayers()))
                    {
                        FlipLeftFlipper();
                    }
                    else if (KeyboardControls.KeyboardNone(ConvertToPlayers()))
                    {
                        ResetLeftFlipper();
                    }

                    break;

                case SupportedControllers.KeyboardP1ControllerP2:

                    if (ConvertToPlayers() == Players.P1)
                    {
                        if (KeyboardControls.KeyboardLeft(Players.P1))
                        {
                            FlipLeftFlipper();
                        }
                        else if (KeyboardControls.KeyboardNone(Players.P1))
                        {
                            ResetLeftFlipper();
                        }
                    }
                    else
                    {
                        if (ControllerControls.ControllerLeft(Players.P1))
                        {
                            FlipLeftFlipper();
                        }
                        else if (ControllerControls.ControllerNone(Players.P1))
                        {
                            ResetLeftFlipper();
                        }
                    }

                    break;

                case SupportedControllers.KeyboardP2ControllerP1:

                    if (ConvertToPlayers() == Players.P2)
                    {
                        if (KeyboardControls.KeyboardLeft(Players.P1))
                        {
                            FlipLeftFlipper();
                        }
                        else if (KeyboardControls.KeyboardNone(Players.P1))
                        {
                            ResetLeftFlipper();
                        }
                    }
                    else
                    {
                        if (ControllerControls.ControllerLeft(Players.P1))
                        {
                            FlipLeftFlipper();
                        }
                        else if (ControllerControls.ControllerNone(Players.P1))
                        {
                            ResetLeftFlipper();
                        }
                    }

                    break;

                default:
                    break;
                }


                break;

            case FlipperSides.Right:

                switch (ControllerType)
                {
                case SupportedControllers.ArcadeBoard:

                    if (ArcadeControls.JoystickRight(Input))
                    {
                        FlipRightFlipper();
                    }
                    else if (ArcadeControls.JoystickNone(Input))
                    {
                        ResetRightFlipper();
                    }

                    break;

                case SupportedControllers.GamePadBoth:

                    if (ControllerControls.ControllerRight(ConvertToPlayers()))
                    {
                        FlipRightFlipper();
                    }
                    else if (ControllerControls.ControllerNone(ConvertToPlayers()))
                    {
                        ResetRightFlipper();
                    }

                    break;

                case SupportedControllers.KeyboardBoth:

                    if (KeyboardControls.KeyboardRight(ConvertToPlayers()))
                    {
                        FlipRightFlipper();
                    }
                    else if (KeyboardControls.KeyboardNone(ConvertToPlayers()))
                    {
                        ResetRightFlipper();
                    }

                    break;

                case SupportedControllers.KeyboardP1ControllerP2:

                    if (ConvertToPlayers() == Players.P1)
                    {
                        if (KeyboardControls.KeyboardRight(Players.P1))
                        {
                            FlipRightFlipper();
                        }
                        else if (KeyboardControls.KeyboardNone(Players.P1))
                        {
                            ResetRightFlipper();
                        }
                    }
                    else
                    {
                        if (ControllerControls.ControllerRight(Players.P1))
                        {
                            FlipRightFlipper();
                        }
                        else if (ControllerControls.ControllerNone(Players.P1))
                        {
                            ResetRightFlipper();
                        }
                    }

                    break;

                case SupportedControllers.KeyboardP2ControllerP1:

                    if (ConvertToPlayers() == Players.P2)
                    {
                        if (KeyboardControls.KeyboardRight(Players.P1))
                        {
                            FlipRightFlipper();
                        }
                        else if (KeyboardControls.KeyboardNone(Players.P1))
                        {
                            ResetRightFlipper();
                        }
                    }
                    else
                    {
                        if (ControllerControls.ControllerRight(Players.P1))
                        {
                            FlipRightFlipper();
                        }
                        else if (ControllerControls.ControllerNone(Players.P1))
                        {
                            ResetRightFlipper();
                        }
                    }

                    break;

                default:
                    break;
                }


                break;

            default:
                break;
            }
        }
コード例 #9
0
        protected override void Update()
        {
            switch (ControllerType)
            {
            case SupportedControllers.ArcadeBoard:

                // Player 1
                if ((ArcadeControls.JoystickLeft(Joysticks.White) && (!IsCoR_P1) && (!ReadyP1)))
                {
                    StartCoroutine(ToggleSelP1(1));
                }
                if ((ArcadeControls.JoystickRight(Joysticks.White) && (!IsCoR_P1) && (!ReadyP1)))
                {
                    StartCoroutine(ToggleSelP1(-1));
                }

                if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B8))
                {
                    am.Play("Menu_Select", .75f);
                    ReadyP1          = !ReadyP1;
                    Ready[0].enabled = ReadyP1;
                }

                if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B7))
                {
                    am.Play("Confirm", .25f);
                    SC.MoveToDucks  = false;
                    SC.MoveToRounds = true;
                    RSC.enabled     = true;
                    this.enabled    = false;
                }

                // Player 2
                if ((ArcadeControls.JoystickLeft(Joysticks.Black) && (!IsCoR_P2) && (!ReadyP2)))
                {
                    StartCoroutine(ToggleSelP2(1));
                }
                if ((ArcadeControls.JoystickRight(Joysticks.Black) && (!IsCoR_P2) && (!ReadyP2)))
                {
                    StartCoroutine(ToggleSelP2(-1));
                }

                if (ArcadeControls.ButtonPress(Joysticks.Black, Buttons.B8))
                {
                    am.Play("Menu_Select", .75f);
                    ReadyP2          = !ReadyP2;
                    Ready[1].enabled = ReadyP2;
                }

                break;

            case SupportedControllers.GamePadBoth:

                // Player 1
                if ((ControllerControls.ControllerLeft(Players.P1) && (!IsCoR_P1) && (!ReadyP1)))
                {
                    StartCoroutine(ToggleSelP1(1));
                }
                if ((ControllerControls.ControllerRight(Players.P1) && (!IsCoR_P1) && (!ReadyP1)))
                {
                    StartCoroutine(ToggleSelP1(-1));
                }

                if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.Confirm))
                {
                    am.Play("Menu_Select", .75f);
                    ReadyP1          = !ReadyP1;
                    Ready[0].enabled = ReadyP1;
                }

                if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.B))
                {
                    am.Play("Confirm", .25f);
                    SC.MoveToDucks  = false;
                    SC.MoveToRounds = true;
                    RSC.enabled     = true;
                    this.enabled    = false;
                }

                // Player 2
                if ((ControllerControls.ControllerLeft(Players.P2) && (!IsCoR_P2) && (!ReadyP2)))
                {
                    StartCoroutine(ToggleSelP2(1));
                }
                if ((ControllerControls.ControllerRight(Players.P2) && (!IsCoR_P2) && (!ReadyP2)))
                {
                    StartCoroutine(ToggleSelP2(-1));
                }

                if (ControllerControls.ButtonPress(Players.P2, ControllerButtons.Confirm))
                {
                    am.Play("Menu_Select", .75f);
                    ReadyP2          = !ReadyP2;
                    Ready[1].enabled = ReadyP2;
                }

                break;

            case SupportedControllers.KeyboardBoth:

                if ((KeyboardControls.KeyboardLeft(Players.P1) && (!IsCoR_P1) && (!ReadyP1)))
                {
                    StartCoroutine(ToggleSelP1(1));
                }
                if ((KeyboardControls.KeyboardRight(Players.P1) && (!IsCoR_P1) && (!ReadyP1)))
                {
                    StartCoroutine(ToggleSelP1(-1));
                }

                if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8))
                {
                    am.Play("Menu_Select", .75f);
                    ReadyP1          = !ReadyP1;
                    Ready[0].enabled = ReadyP1;
                }

                if (KeyboardControls.ButtonPress(Players.P1, Buttons.B7))
                {
                    am.Play("Confirm", .25f);
                    SC.MoveToDucks  = false;
                    SC.MoveToRounds = true;
                    RSC.enabled     = true;
                    this.enabled    = false;
                }

                // Player 2
                if ((KeyboardControls.KeyboardLeft(Players.P2) && (!IsCoR_P2) && (!ReadyP2)))
                {
                    StartCoroutine(ToggleSelP2(1));
                }
                if ((KeyboardControls.KeyboardRight(Players.P2) && (!IsCoR_P2) && (!ReadyP2)))
                {
                    StartCoroutine(ToggleSelP2(-1));
                }

                if (KeyboardControls.ButtonPress(Players.P2, Buttons.B8))
                {
                    am.Play("Menu_Select", .75f);
                    ReadyP2          = !ReadyP2;
                    Ready[1].enabled = ReadyP2;
                }

                break;

            case SupportedControllers.KeyboardP1ControllerP2:

                if ((KeyboardControls.KeyboardLeft(Players.P1) && (!IsCoR_P1) && (!ReadyP1)))
                {
                    StartCoroutine(ToggleSelP1(1));
                }
                if ((KeyboardControls.KeyboardRight(Players.P1) && (!IsCoR_P1) && (!ReadyP1)))
                {
                    StartCoroutine(ToggleSelP1(-1));
                }

                if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8))
                {
                    am.Play("Menu_Select", .75f);
                    ReadyP1          = !ReadyP1;
                    Ready[0].enabled = ReadyP1;
                }

                if (KeyboardControls.ButtonPress(Players.P1, Buttons.B7))
                {
                    am.Play("Confirm", .25f);
                    SC.MoveToDucks  = false;
                    SC.MoveToRounds = true;
                    RSC.enabled     = true;
                    this.enabled    = false;
                }

                if ((ControllerControls.ControllerLeft(Players.P1) && (!IsCoR_P2) && (!ReadyP2)))
                {
                    StartCoroutine(ToggleSelP2(1));
                }
                if ((ControllerControls.ControllerRight(Players.P1) && (!IsCoR_P2) && (!ReadyP2)))
                {
                    StartCoroutine(ToggleSelP2(-1));
                }

                if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.A))
                {
                    am.Play("Menu_Select", .75f);
                    ReadyP2          = !ReadyP2;
                    Ready[1].enabled = ReadyP2;
                }

                break;

            case SupportedControllers.KeyboardP2ControllerP1:

                if ((ControllerControls.ControllerLeft(Players.P1) && (!IsCoR_P1) && (!ReadyP1)))
                {
                    StartCoroutine(ToggleSelP1(1));
                }
                if ((ControllerControls.ControllerRight(Players.P1) && (!IsCoR_P1) && (!ReadyP1)))
                {
                    StartCoroutine(ToggleSelP1(-1));
                }

                if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.A))
                {
                    am.Play("Menu_Select", .75f);
                    ReadyP1          = !ReadyP1;
                    Ready[0].enabled = ReadyP1;
                }

                if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.B))
                {
                    am.Play("Confirm", .25f);
                    SC.MoveToDucks  = false;
                    SC.MoveToRounds = true;
                    RSC.enabled     = true;
                    this.enabled    = false;
                }

                if ((KeyboardControls.KeyboardLeft(Players.P1) && (!IsCoR_P2) && (!ReadyP2)))
                {
                    StartCoroutine(ToggleSelP2(1));
                }
                if ((KeyboardControls.KeyboardRight(Players.P1) && (!IsCoR_P2) && (!ReadyP2)))
                {
                    StartCoroutine(ToggleSelP2(-1));
                }

                if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8))
                {
                    am.Play("Menu_Select", .75f);
                    ReadyP2          = !ReadyP2;
                    Ready[1].enabled = ReadyP2;
                }

                break;

            default:
                break;
            }

            if (ReadyP1 && ReadyP2)
            {
                QuackingTimeData _data = new QuackingTimeData(Duck1Pos, Duck2Pos);
                SaveManager.SaveQuackingTime(_data);
                ChangeScene.ChangeToLevel();
            }
        }
コード例 #10
0
        void MenuInput_MultiOption()
        {
            switch (InputDir)
            {
            case Directions.Hoz:

                switch (ControllerType)
                {
                case SupportedControllers.ArcadeBoard:

                    if (ArcadeControls.JoystickLeft(Joysticks.White))
                    {
                        StartCoroutine(MoveAroundMenu(-1));
                    }
                    if (ArcadeControls.JoystickRight(Joysticks.White))
                    {
                        StartCoroutine(MoveAroundMenu(1));
                    }

                    break;

                case SupportedControllers.GamePadBoth:

                    if (ControllerControls.ControllerLeft(Players.P1))
                    {
                        StartCoroutine(MoveAroundMenu(-1));
                    }
                    if (ControllerControls.ControllerRight(Players.P1))
                    {
                        StartCoroutine(MoveAroundMenu(1));
                    }

                    break;

                case SupportedControllers.KeyboardBoth:

                    if (KeyboardControls.KeyboardLeft(Players.P1))
                    {
                        StartCoroutine(MoveAroundMenu(-1));
                    }
                    if (KeyboardControls.KeyboardRight(Players.P1))
                    {
                        StartCoroutine(MoveAroundMenu(1));
                    }

                    break;

                case SupportedControllers.KeyboardP1ControllerP2:

                    if (KeyboardControls.KeyboardLeft(Players.P1))
                    {
                        StartCoroutine(MoveAroundMenu(-1));
                    }
                    if (KeyboardControls.KeyboardRight(Players.P1))
                    {
                        StartCoroutine(MoveAroundMenu(1));
                    }

                    break;

                case SupportedControllers.KeyboardP2ControllerP1:

                    if (ControllerControls.ControllerLeft(Players.P1))
                    {
                        StartCoroutine(MoveAroundMenu(-1));
                    }
                    if (ControllerControls.ControllerRight(Players.P1))
                    {
                        StartCoroutine(MoveAroundMenu(1));
                    }

                    break;

                default:
                    break;
                }

                break;

            case Directions.Ver:

                switch (ControllerType)
                {
                case SupportedControllers.ArcadeBoard:

                    if (ArcadeControls.JoystickUp(Joysticks.White))
                    {
                        StartCoroutine(MoveAroundMenu(-1));
                    }
                    if (ArcadeControls.JoystickDown(Joysticks.White))
                    {
                        StartCoroutine(MoveAroundMenu(1));
                    }

                    break;

                case SupportedControllers.GamePadBoth:

                    if (ControllerControls.ControllerUp(Players.P1))
                    {
                        StartCoroutine(MoveAroundMenu(-1));
                    }
                    if (ControllerControls.ControllerDown(Players.P1))
                    {
                        StartCoroutine(MoveAroundMenu(1));
                    }

                    break;

                case SupportedControllers.KeyboardBoth:

                    if (KeyboardControls.KeyboardUp(Players.P1))
                    {
                        StartCoroutine(MoveAroundMenu(-1));
                    }
                    if (KeyboardControls.KeyboardDown(Players.P1))
                    {
                        StartCoroutine(MoveAroundMenu(1));
                    }

                    break;

                case SupportedControllers.KeyboardP1ControllerP2:

                    if (KeyboardControls.KeyboardUp(Players.P1))
                    {
                        StartCoroutine(MoveAroundMenu(-1));
                    }
                    if (KeyboardControls.KeyboardDown(Players.P1))
                    {
                        StartCoroutine(MoveAroundMenu(1));
                    }

                    break;

                case SupportedControllers.KeyboardP2ControllerP1:

                    if (ControllerControls.ControllerUp(Players.P1))
                    {
                        StartCoroutine(MoveAroundMenu(-1));
                    }
                    if (ControllerControls.ControllerDown(Players.P1))
                    {
                        StartCoroutine(MoveAroundMenu(1));
                    }

                    break;

                default:
                    break;
                }

                break;
            }

            switch (ControllerType)
            {
            case SupportedControllers.ArcadeBoard:

                if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B8))
                {
                    RunEvent();
                }

                break;

            case SupportedControllers.GamePadBoth:

                if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.Confirm))
                {
                    RunEvent();
                }

                break;

            case SupportedControllers.KeyboardBoth:

                if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8))
                {
                    RunEvent();
                }

                break;

            case SupportedControllers.KeyboardP1ControllerP2:

                if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8))
                {
                    RunEvent();
                }

                break;

            case SupportedControllers.KeyboardP2ControllerP1:

                if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.Confirm))
                {
                    RunEvent();
                }

                break;

            default:
                break;
            }
        }