public SafePathResult(bool isSafe, FoundIntersection intersection) { this.IsSafe = isSafe; this.Intersection = intersection; }
private static SafePathResult IsSafePath(List<Vector2> path, int timeOffset, int speed = -1, int delay = 0) { var isSafe = false; var intersections = new List<FoundIntersection>(); var intersection = new FoundIntersection(); foreach (var sResult in SkillshotDetector.DetectedSkillshots.Where(i => i.Evade) .Select(i => i.IsSafePath(path, timeOffset, speed, delay))) { isSafe = sResult.IsSafe; if (sResult.Intersection.Valid) { intersections.Add(sResult.Intersection); } } return isSafe ? new SafePathResult(true, intersection) : new SafePathResult( false, intersections.Count > 0 ? intersections.MinOrDefault(i => i.Distance) : intersection); }