Esempio n. 1
0
    private void GetInput()
    {
        if (isInputInitialized)
        {
            if (canReceiveInput)
            {
                xAxisInput = playerInput.GetAxis("HorizontalAxis");
                yAxisInput = playerInput.GetAxis("VerticalAxis");

                inputVector.Set(xAxisInput, yAxisInput);

                xAxisRawInput = playerInput.GetAxisRaw("HorizontalAxis");
                yAxisRawInput = playerInput.GetAxisRaw("VerticalAxis");

                inputDirectionVector = ReturnInputDirectionVector(xAxisRawInput, yAxisRawInput);

                if (playerInput.GetButtonDown("Jump"))
                {
                    playerController.PlayerJump();
                }
                if (playerInput.GetButtonUp("Jump"))
                {
                    playerController.PlayerJumpEarlyRelease();
                }

                if (playerInput.GetButtonDown("Dash"))
                {
                    playerController.PlayerDash();
                }

                if (playerInput.GetButtonDown("Sprint"))
                {
                    playerController.StartSprint();
                }

                if (playerInput.GetButtonUp("Sprint"))
                {
                    playerController.StopSprint();
                }

                if (playerInput.GetButtonDown("Attack"))
                {
                    playerController.PlayerAttack();
                }

                if (playerInput.GetButtonDown("Reset"))
                {
                    playerController.ResetController();
                }

                playerController.ReceiveInputData(inputVector, inputDirectionVector);
            }
        }
    }
Esempio n. 2
0
    private void GetInput()
    {
        if (isInputInitialized)
        {
            if (canReceiveInput)
            {
                xAxisInput = playerInput.GetAxis("HorizontalAxis");
                yAxisInput = playerInput.GetAxis("VerticalAxis");

                inputVector.Set(xAxisInput, yAxisInput);

                xAxisRawInput = playerInput.GetAxisRaw("HorizontalAxis");
                yAxisRawInput = playerInput.GetAxisRaw("VerticalAxis");

                inputDirectionVector = ReturnInputDirectionVector(xAxisRawInput, yAxisRawInput);

                if (playerInput.GetButtonDown("Jump"))
                {
                    playerCapturedInput.playerActions.Add(PlayerActions.JUMP);

                    playerController.PlayerJump();
                }
                if (playerInput.GetButtonUp("Jump"))
                {
                    playerCapturedInput.playerActions.Add(PlayerActions.JUMP);

                    playerController.PlayerJumpEarlyRelease();
                }

                if (playerInput.GetButtonDown("Dash"))
                {
                    playerCapturedInput.playerActions.Add(PlayerActions.DASH);

                    playerController.PlayerDash();
                }

                if (playerInput.GetButtonDown("Attack"))
                {
                    playerCapturedInput.playerActions.Add(PlayerActions.ATTACK);

                    playerController.PlayerAttack();
                }

                if (playerInput.GetButtonDown("SelectWeapon1"))
                {
                    playerCapturedInput.playerActions.Add(PlayerActions.SWITCH_WEAPONS);

                    playerController.SwitchWeapons(0);
                }
                else if (playerInput.GetButtonDown("SelectWeapon2"))
                {
                    playerCapturedInput.playerActions.Add(PlayerActions.SWITCH_WEAPONS);

                    playerController.SwitchWeapons(1);
                }
                else if (playerInput.GetButtonDown("SelectWeapon3"))
                {
                    playerCapturedInput.playerActions.Add(PlayerActions.SWITCH_WEAPONS);

                    playerController.SwitchWeapons(2);
                }
                else if (playerInput.GetButtonDown("SelectWeapon4"))
                {
                    playerCapturedInput.playerActions.Add(PlayerActions.SWITCH_WEAPONS);

                    playerController.SwitchWeapons(3);
                }

                if (playerInput.GetButtonDown("Reset"))
                {
                    playerController.ResetController();
                }

                playerController.ReceiveInputData(inputVector, inputDirectionVector, playerCapturedInput);

                playerCapturedInput.Reset();
            }
        }
    }