private void printChildren(ChunkCoordinate c, int depth) { for (int i = 0; i < c.Depth; i++) { Console.Write("---"); } Console.WriteLine(c); if (c.Depth == depth) { return; } c.GetChildren().ForEach(v => printChildren(v, depth)); }
public static IEnumerable <ChunkCoordinate> FindChunksDown(this IWorldOctree tree, ChunkCoordinate parent, int maxDepth, Func <ChunkCoordinate, bool> condition) { if (!condition(parent)) { yield break; } if (tree.IsLeaf(parent) || parent.Depth == maxDepth) { yield return(parent); yield break; } foreach (var child in parent.GetChildren()) { foreach (var res in FindChunksDown(tree, child, maxDepth, condition)) { yield return(res); } } }