//Hanle player movement and its animation private void handelMovement(float horizontal) { if (MyRigibody.velocity.y < 0) { MyAnimator.SetBool("land", true); } if (!Attack && !Slide && (OnGround || airControll)) { MyRigibody.velocity = new Vector2(horizontal * moveSpeed, MyRigibody.velocity.y); } if (Jump && MyRigibody.velocity.y == 0) { MyRigibody.AddForce(new Vector2(0, jumpForce)); } MyAnimator.SetFloat("speed", Mathf.Abs(horizontal)); }
private void HandleMovement(float horizontal) { if (MyRigibody.velocity.y < 0) { MyAnimator.SetBool("land", true); } if (!Attack) { MyRigibody.velocity = new Vector2(horizontal * movementSpeed, MyRigibody.velocity.y); } // if(!this.myAnimator.GetCurrentAnimatorStateInfo(0).IsTag("Attack") ) // { // MyRigibody.velocity = new Vector2(horizontal * movementSpeed, MyRigibody.velocity.y); // myAnimator.SetFloat("speed", Mathf.Abs(horizontal)); // } if (OnGround && Jump && MyRigibody.velocity.y == 0) { OnGround = false; MyRigibody.AddForce(new Vector2(0, jumpFrouce)); } MyAnimator.SetFloat("speed", Mathf.Abs(horizontal)); }