public int jumpForce;
public int jumptimes = 2;
private int jumpCount;
public void JumpMax()
{
if (ani.GetBool("Heart")) return;
if (Physics2D.OverlapCircle(foot.position, 0.2f, ground))
{
jumpCount = jumptimes ;
ani.SetBool("Jumping", false);
}
if (Input.GetButtonDown("Jump") && Physics2D.OverlapCircle(foot.position, 0.2f, ground))
{
au.PlayOneShot(jump, 1f);
playerR.velocity = new Vector2(playerR.velocity.x, jumpForce );
ani.SetBool("Jumping", true);
ani.SetBool("Idle", false);
ani.SetBool("Down", false);
jumpCount--;
}else if(Input.GetButtonDown("Jump")&& jumpCount > 0&& !Physics2D.OverlapCircle(foot.position, 0.2f, ground))
{
au.PlayOneShot(jump, 1f);
playerR.velocity = new Vector2(playerR.velocity.x, jumpForce );
ani.SetBool("Jumping", true);
ani.SetBool("Idle", false);
ani.SetBool("Down", false);
jumpCount--;
}
} public void JumpMax()
{
if (ani.GetBool("Heart")) return;
if (Physics2D.OverlapCircle(foot.position, 0.2f, ground))
{
jumpCount = jumptimes ;
ani.SetBool("Jumping", false);
}
if (Input.GetButtonDown("Jump") && Physics2D.OverlapCircle(foot.position, 0.2f, ground))
{
au.PlayOneShot(jump, 1f);
playerR.velocity = new Vector2(playerR.velocity.x, jumpForce );
ani.SetBool("Jumping", true);
ani.SetBool("Idle", false);
ani.SetBool("Down", false);
jumpCount--;
}else if(Input.GetButtonDown("Jump")&& jumpCount > 0&& !Physics2D.OverlapCircle(foot.position, 0.2f, ground))
{
au.PlayOneShot(jump, 1f);
playerR.velocity = new Vector2(playerR.velocity.x, jumpForce );
ani.SetBool("Jumping", true);
ani.SetBool("Idle", false);
ani.SetBool("Down", false);
jumpCount--;
}
}