public static SafePathResult IsSafePath(List<Vector2> path, int timeOffset, int speed = -1, int delay = 0) { var isSafe = true; var intersections = new List<FoundIntersection>(); var intersection = new FoundIntersection(); foreach (var sResult in from skillshot in DetectedSkillshots where skillshot.Enable select skillshot.IsSafePath(path, timeOffset, speed, delay)) { isSafe = isSafe && sResult.IsSafe; if (sResult.Intersection.Valid) { intersections.Add(sResult.Intersection); } } if (isSafe) { return new SafePathResult(true, intersection); } var intersetion = intersections.MinOrDefault(i => i.Distance); return new SafePathResult(false, intersetion.Valid ? intersetion : intersection); }
public SafePathResult(bool isSafe, FoundIntersection intersection) { this.IsSafe = isSafe; this.Intersection = intersection; }