//Handles the direction and animations of the body public void BodyAnimationManager(BodyDirection MoveDirection) { if (gameObject.GetComponent <Player>().PlayerCanMove == false) { BodyAnimator.Play("Standing"); } else { if (MoveDirection == BodyDirection.Down) { BodyAnimator.Play("WalkDown"); } else if (MoveDirection == BodyDirection.Up) { BodyAnimator.Play("WalkUp"); } else if (MoveDirection == BodyDirection.Left) { BodyAnimator.Play("WalkLeft"); } else if (MoveDirection == BodyDirection.Right) { BodyAnimator.Play("WalkRight"); } else if (MoveDirection == BodyDirection.Static) { BodyAnimator.Play("Standing"); } } }
public void RightMove() { //transform.localPosition += Vector3.right * moveSpeed * Time.deltaTime; //rb2D.velocity += (Vector2)Vector3.right * moveSpeed * Time.deltaTime; rb2D.velocity = new Vector2(Vector3.right.x * moveSpeed, rb2D.velocity.y); //rb2D.velocity = new Vector2(rb2D.velocity.x + Vector3.right.x * moveSpeed, rb2D.velocity.y); currentBodyDirection = BodyDirection.Right; if (transform.tag == "Player") { animator.SetBool("isAttack", false); animator.SetBool("isGuard", false); animator.SetBool("isWalk", true); renderer.flipX = false; } }