public MovementFunc GenerateGuidePath(IList <PlatformInfo> platforms, float runSpeed) { IList <MovementFunc> segments = new List <MovementFunc>(platforms.Count * 2); foreach (var platform in platforms) { Vector2 runFrom = platform.GetLandPoint(), runTo = platform.GetJumpPoint(); float runDuration = Vector2.Distance(runFrom, runTo) / runSpeed; segments.Add(new MovementFunc(t => Vector2.Lerp(runFrom, runTo, t / runDuration), runDuration)); MovementFunc jf = platform.GetJumpFunction(); segments.Add(new MovementFunc(t => runTo + jf.f(t), jf.duration)); } return(MovementFunc.combine(segments)); }