помогите пожалуйста с методом Jump в unity2d
Добрый день я сделал скрип управление персонажем под андроид с помощью кнопок но кнопка Jump не работает как надо при первом клике персонаж подпрыгивает но при нажатии во второй раз ничего не происходит и если я буду водить пальцем по кнопке Jump то мой персонаж улетает в космос
void Start()
{
rb2d = GetComponent<Rigidbody2D>();
}
void Update()
{
if ((directionInput < 0) && (facingRight))
{
Flip();
}
if ((directionInput > 0) && (!facingRight))
{
Flip();
}
groundCheck = true;
}
void FixedUpdate()
{
rb2d.velocity = new Vector2(playerSpeed * directionInput, rb2d.velocity.y);
}
public void Move(int InputAxis)
{
directionInput = InputAxis;
}
public void Jump(bool isJump)
{
isJump = groundCheck;
if (groundCheck)
{
rb2d.velocity = new Vector2(rb2d.velocity.x, jumpPower);
}
}
void Flip()
{
facingRight = !facingRight;
Vector3 theScale = transform.localScale;
theScale.x *= -1;
transform.localScale = theScale;
}