示例#1
0
    public void CreateBranch()
    {
        for (int x = 0; x < 2; x++)
        {
            for (int j = 0; j < 2; j++)
            {
                for (int k = 0; k < 2; k++)
                {
                    GameObject point = Instantiate(branch, (transform.position + (new Vector3(x * worldsize / 2, j * worldsize / 2, k * worldsize / 2))), transform.rotation) as GameObject;
                    point.SetActive(false);
                    //point.AddComponent<octree_07>();
                    octree_07 treescript = point.GetComponent <octree_07>();
                    treescript.setID(limit);

                    treescript.lowertier(limit, tier, worldsize, leafs, branch, pool, gameObject, outsideNode);
                    treescript.updateBar(barcode);
                    treescript.setBar(limit, tier, setZone(point, transform.position));

                    point.transform.SetParent(transform);
                    point.name = "" + x + " " + j + " " + k + " " + count;
                    point.SetActive(true);
                    Listquad[count] = point;
                    count++;
                }
            }
        }
        count = 0;
    }
示例#2
0
    //public List<catagorize> leafList;
    // Use this for initialization
    void Start()
    {
        Listquad = new GameObject[8];
        boxlimit = (int)Mathf.Pow(2, (limit + 1));
        outBox   = outsideNode.GetComponent <catagorize>();
        if (first)
        {
            dimension = (worldsize / (Mathf.Pow(2f, (limit + 1))));

            leaf_count = 0;
            barcode    = new int[limit + 1];
            tier       = limit;
            if (UpperBranch == null)
            {
                UpperBranch = gameObject;
            }
            root     = new catagorize[(int)Mathf.Pow(8, limit + 1)];
            RootNode = gameObject.GetComponent <octree_07>();
        }
        if (tier > 0)
        {
            CreateBranch();
        }
        else
        {
            CreateLeaves();
        }
    }
示例#3
0
    // Use this for initialization
    void Start()
    {
        if (gameObject.CompareTag("Moot"))
        {
        }
        else
        {
            id_numb = Id_Assign.GetComponent <ID_Assigner>().getID(transform);
        }
        tree_bark = tree.GetComponent <octree_07>();
        bounds    = tree_bark.giveDim();

        segments  = tree_bark.giveLim();
        total_box = (int)Mathf.Pow(2, (segments + 1));

        branch = new GameObject[segments + 1];
        idcode = new int[segments + 1];

        setbound(transform.position);
        headingTo   = (x * (total_box * total_box)) + (y * total_box) + z;
        currentZone = (x * (total_box * total_box)) + (y * total_box) + z;;
        List        = tree_bark.get_object(x, y, z);
        List.Add_Test(gameObject);
    }
示例#4
0
 public void setStump(GameObject seed)
 {
     Stump = seed.GetComponent <octree_07>();
 }