using System.Collections; using System.Collections.Generic; using Godot; using System; namespace Rokojori { public class OcTreeWalker:TreeWalker> { public override OcTreeNode Parent( OcTreeNode node ) { if ( node is OcTree ) { return null; } var cell = node as OcTreeCell; return cell.isRoot ? cell.tree : cell.parent; } public override int NumChildren( OcTreeNode node ) { if ( node is OcTree tree ) { return tree.rootCells.Count; } var cell = node as OcTreeCell; return cell.numCells; } public override OcTreeNode ChildAt( OcTreeNode node, int index ) { if ( index < 0 || index >= NumChildren( node ) ) { return null; } if ( node is OcTree tree ) { return tree.rootCells[ index ]; } var cell = node as OcTreeCell; return cell.cells[ index ]; } } }