Question by
kay-svk · Jun 23, 2017 at 04:17 AM ·
yield waitforseconds
EInumerator dont stop velocity I need 3sec to breake.. pls help
private void FixedUpdate() { if(isAlive) { anim.SetFloat("verticalSpeed", myRB.velocity.y); myRB.velocity =new Vector2(moveSpeed, myRB.velocity.y);
if (jump)
{
anim.SetBool("Jump", true);
StartCoroutine(Breake());
myRB.velocity = new Vector2(moveSpeed, jumpForce4);
jump = false;
}
}
}
public void Jump()
{
if (grounded)
{
jump = true;
}
}
IEnumerator Breake()
{
myRB.velocity = Vector2.zero;
yield return new WaitForSeconds(3);
}
Comment
Your answer