Example #1
0
    private void TraverseNode(Utils.INode node, Vector3 p)
    {
        if (node == null)
        {
            return;
        }

        if (!node.IsLeaf())
        {
            TraverseNode(node.GetNext(p), p);
        }

        node.Execute();
    }
Example #2
0
 private void BuildTree()
 {
     // 1
     root = new Utils.BSPNode(
         new Utils.Plane(Vector3.right, 0f),
         new Utils.BSPNode(
             new Utils.Plane(Vector3.up, 0f),
             Utils.BSPNode.CreateLeaf(ChangeColorRed),
             Utils.BSPNode.CreateLeaf(ChangeColorBlue),
             null
             ),
         new Utils.BSPNode(
             new Utils.Plane(Vector3.up, 0f),
             Utils.BSPNode.CreateLeaf(ChangeColorGreen),
             Utils.BSPNode.CreateLeaf(ChangeColorYellow),
             null
             ),
         null
         );
 }