public void GetActiveCells(List <byte> activeCells, bool yIsUpAxis, Vector3 position) { if (this.NodeType != CellTreeNode.ENodeType.Leaf) { using (List <CellTreeNode> .Enumerator enumerator = this.Childs.GetEnumerator()) { while (enumerator.MoveNext()) { CellTreeNode current = enumerator.get_Current(); current.GetActiveCells(activeCells, yIsUpAxis, position); } } } else if (this.IsPointNearCell(yIsUpAxis, position)) { if (this.IsPointInsideCell(yIsUpAxis, position)) { activeCells.Insert(0, this.Id); for (CellTreeNode parent = this.Parent; parent != null; parent = parent.Parent) { activeCells.Insert(0, parent.Id); } } else { activeCells.Add(this.Id); } } }