private void LeftGroundEvent() { Debug.Log("Left Ground!!"); if (!isNormalJumping) { isInCoyoteTime = true; coyoteJumpTimer.StartTimer(); } }
/// <summary> /// Check the jump condition, if canJump, preform a jump. /// </summary> public void Jump() { if (!isGrounded && !isRightWalled && !isLeftWalled && !isInCoyoteTime) {//before jump jumpRegisteredInAir = true; jumpBufferTimer.StartTimer(); return; } int currentWallJumpDirection = GetCurrentWallJumpDirection(); if (currentWallJumpDirection == 0) {//normal jump rb2d.velocity = new Vector3(rb2d.velocity.x, normalJumpInitialVelocity, 0); isNormalJumping = true; } else {//wall jump rb2d.velocity = new Vector3(rb2d.velocity.x + currentWallJumpDirection * wallJumpHorizontalInitialVelocity, rb2d.velocity.y / 2 + wallJumpVerticalInitialVelocity, 0); isWallJumping = true; wallJumpDirection = currentWallJumpDirection; } }