Esempio n. 1
0
 public void MoveBackward()
 {
     if (!attack)
     {
         CharaAnimator.SetFloat("speed", 1f);
         transform.Translate(GetDirection() * (movementSpeed * Time.deltaTime) * -1);
     }
 }
 private void HandleMovement(float horizontal)
 {
     if (charaRigidbody2D.velocity.y < 0)
     {
         CharaAnimator.SetBool("land", true);
     }
     if (!attack && !guard && !crouch && (onGround || airControl))
     {
         charaRigidbody2D.velocity = new Vector2(horizontal * movementSpeed, charaRigidbody2D.velocity.y);
     }
     if (jump && charaRigidbody2D.velocity.y == 0)
     {
         charaRigidbody2D.AddForce(new Vector2(0, jumpForce));
     }
     CharaAnimator.SetFloat("speed", Mathf.Abs(horizontal));
 }