// Return true when the jump ended early due tile height. private bool ProcessFrogJump(float jumpProgress) { Vector3 animatedPos = Vector3.LerpUnclamped(frogStartPos, frogEndPos, jumpProgress); float jumpHeight = jumpCurve.Evaluate(jumpProgress) * (FROG_BASE_JUMP_HEIGHT + (curJumpDist * FROG_JUMP_HEIGHT_MULTIPLIER)); animatedPos.y += jumpHeight; // Vertical movement. frog.position = animatedPos; // Apply blob shadow to surface below. Vector3 shadowPos = animatedPos; shadowPos.y -= jumpHeight; if (attachedTile != null && shadowPos.y < attachedTile.topSurfaceY) { shadowPos.y = attachedTile.topSurfaceY; } frogShadow.position = shadowPos + frogShadowOffset; idleTimer = 0f; // Animate frog tilting. AnimateFrogTilt(jumpProgress); // Shrink and fade out shadow as it gets further from the surface. UpdateFrogShadow(jumpHeight); // Detect if we landed on any tiles early (after peak of the jump / accelerating down). if (jumpProgress > jumpPeakTime) { int landedPosIndex; for (int i = 0; i < tileController.activeTiles.Count; i++) { TileEntity thisTile = tileController.activeTiles[i]; float thisTopY = thisTile.topSurfaceY; // We passed through top surface during descent and within hitbox. if (animatedPos.y < thisTopY && thisTile.CanLand(animatedPos, frogRadius, out landedPosIndex)) { // Update animation end pos to top surface of this tile. animatedPos.y = thisTopY; frogEndPos = animatedPos; return(true); } } } return(false); }