private void RecalculateAllPaths() { PathCollection.Clear(); foreach (var start in StructureManager) { if (!PathCollection.ContainsKey(start.Position)) { PathCollection.Add(start.Position, new Dictionary <HexagonNode, Path>()); } foreach (var destination in StructureManager) { try { if (!PathCollection[start.Position].ContainsKey(destination.Position)) { Path path = new Path(PathFinding.AStar(start.Position, destination.Position).ToArray()); AddPath(path); if (path.AllHops.Count > 2) { var containedPaths = path.GetContainedPaths(); foreach (var containedPath in containedPaths) { AddPath(containedPath); } } } } catch (NoPathFoundException <HexagonNode> ) { } } } }