Esempio n. 1
0
 protected TreeNode()
 {
     this.parent = null;
     this.child = null;
     this.sibling = null;
     this.reverse = null;
 }
        public static void insert(TreeNode toAdd, TreeNode parent)
        {
            Debug.Assert(parent != null);
            Debug.Assert(toAdd != null);

            toAdd.Parent = parent;
            if (parent.Child == null)
            {
                parent.Child = toAdd;
                toAdd.Parent = parent;
            }
            else
            {
                TreeNode node = parent.Child;
                toAdd.Sibling = node;
                parent.Child = toAdd;
            }
        }
        private GameObject getNext(TreeNode node, bool willUseChild = true)
        {
            TreeNode toRet = null;

            if (current.Child != null)
            {
                toRet = node.Child;
            }
            else if (node.Sibling != null)
            {
                toRet = node.Sibling;
            }
            else if (node.Parent != null && node.Parent != this.treeRoot)
            {
                toRet = getNext(node.Parent, false);
            }

            return (GameObject)toRet;
        }
        public ReverseTreeIterator(TreeNode root)
        {
            Debug.Assert(root != null);
            treeRoot = (GameObject)root;
            current = (GameObject)root;

            GameObject go = treeRoot;
            GameObject node = go;

            while (go != null)
            {
                node = go;
                go = this.next();

                if (go != null)
                {
                    go.Reverse = node;
                }

            }

            this.treeRoot = node;
            this.current = node;
        }
Esempio n. 5
0
 public static void setTree(TreeNode tree)
 {
     Instance.ufoTree = tree;
 }
Esempio n. 6
0
 public static void attachTree(TreeNode root)
 {
     Instance.treeRoot = root;
 }
Esempio n. 7
0
 public static void attachTree(TreeNode node)
 {
     Instance.root = node;
 }
Esempio n. 8
0
 public static void setRoot(TreeNode root)
 {
     Instance.treeRoot = root;
 }