private void PlayerMovements(float horizontal, float vertical) { if (FallingDowm && transform.parent == null) { gameObject.layer = 11; Anim.SetBool("land", true); } if (!Attack) { Rgb.velocity = new Vector2(horizontal * speed, Rgb.velocity.y); } if (Jump && Rgb.velocity.y == 0 && !SpaceDoors) { Rgb.AddForce(new Vector2(0, jumpForce)); } if (SpaceDoors) { Rgb.velocity = new Vector2(horizontal * speed, vertical * speed); } if (Rgb.velocity.y < 0) { Rgb.AddForce(new Vector2(0, -100)); } Anim.SetFloat("speed", Mathf.Abs(horizontal)); }
private void PlayerMovements(float horizontal) { if (Rgb.velocity.y < 0) { Anim.SetBool("land", true); } if (!Attack) { Rgb.velocity = new Vector2(horizontal * speed, Rgb.velocity.y); } if (Jump && Rgb.velocity.y == 0) { Rgb.AddForce(new Vector2(0, jumpForce)); } Anim.SetFloat("speed", Mathf.Abs(horizontal)); }