private static FastPredResult FastPrediction(Vector2 from, Obj_AI_Base unit, int delay, int speed)
{
var d = (delay / 1000f + (from.Distance(unit) / speed)) * unit.MoveSpeed;
var path = unit.GetWaypoints();
return path.PathLength() > d
? new FastPredResult
{
IsMoving = true,
CurrentPos = unit.ServerPosition.To2D(),
PredictedPos = path.CutPath((int)d)[0]
}
: (path.Count == 0
? new FastPredResult
{
IsMoving = false,
CurrentPos = unit.ServerPosition.To2D(),
PredictedPos = unit.ServerPosition.To2D()
}
: new FastPredResult
{
IsMoving = false,
CurrentPos = path[path.Count - 1],
PredictedPos = path[path.Count - 1]
});
}