예제 #1
0
    private void Update()
    {
        walk      = Input.GetAxisRaw("Horizontal") * walkSpeed;
        jumpStart = Input.GetButtonDown("Jump");
        jump      = Input.GetButton("Jump");

        CheckGround();

        if (_rigidbody.velocity.magnitude >= 0.1f)
        {
            transform.GetChild(0).GetComponent <Animator>().SetBool("isWalking", true);
            //transform.GetChild(1).GetComponent<Animator>().SetBool("isWalking", true);
        }
        else
        {
            transform.GetChild(0).GetComponent <Animator>().SetBool("isWalking", false);
            //transform.GetChild(1).GetComponent<Animator>().SetBool("isWalking", false);
        }

        if (!isSwinging && !platformRotating && !goalReached)
        {
            Walk();
            Jump();

            if ((walk > 0.0f && !facingRight) || (walk < 0.0f && facingRight) && !PauseUI.GetGameIsPaused())
            {
                Flip();
            }
        }

        if (EndOfLevel.goalReached == true)
        {
            OnReachGoal();
        }
    }