예제 #1
0
    private void CalculateMovementDirection(float absHorizontalInput, float absVericalInput)
    {
        float running         = Input.GetAxis("Running");
        float runningModifier = runningHandler.GetIsRunningModifier(running);

        float actualSpeed = Mathf.Max(absVericalInput, absHorizontalInput) * movementSpeed * runningModifier;

        movementDirection = transform.TransformDirection(new Vector3(0f, movementDirection.y, actualSpeed));
    }
예제 #2
0
    // Update is called once per frame
    public void Animate()
    {
        running = Input.GetAxis("Running");
        float runningModifier = runningHandler.GetIsRunningModifier(running);

        inputY = Input.GetAxis("Vertical") * runningModifier;
        inputX = Input.GetAxis("Horizontal") * runningModifier;

        bool isWalking = inputY != 0f || inputX != 0f;

        animator.SetFloat("InputX", inputX);
        animator.SetFloat("InputY", inputY);

        HandleJumping(isWalking);
        animator.SetBool("IsGrounded", controller.isGrounded);
        animator.SetBool("IsWalking", isWalking);
    }