/// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="numberOfChildNodesPerNode">
 /// The number of child nodes a tree node is allowed to have.
 /// </param>
 public GameObjectSphereTree(int numberOfChildNodesPerNode)
 {
     _numberOfChildNodesPerNode = numberOfChildNodesPerNode;
     _sphereTree = new SphereTree <GameObject>(numberOfChildNodesPerNode);
     EditorApplication.hierarchyWindowChanged -= HierarchyWindowChanged;
     EditorApplication.hierarchyWindowChanged += HierarchyWindowChanged;
 }
Beispiel #2
0
 public SphereTreeNode(Vector3 center, float radius, SphereTree <T> tree, T data = default(T))
 {
     _tree          = tree;
     _data          = data;
     _sphere.Center = center;
     _sphere.Radius = radius;
 }
        public void Rebuild(bool showProgress)
        {
            if (Octave3DWorldBuilder.ActiveInstance == null)
            {
                return;
            }

            _sphereTree = new SphereTree <GameObject>(_numberOfChildNodesPerNode);
            _gameObjectToNode.Clear();
            _serializedNodes.Clear();

            List <GameObject> allWorkingObjects = Octave3DWorldBuilder.ActiveInstance.GetAllWorkingObjects();

            if (showProgress)
            {
                float invObjCount = 1.0f / (float)allWorkingObjects.Count;
                int   numObjects  = allWorkingObjects.Count;
                for (int objIndex = 0; objIndex < numObjects; ++objIndex)
                {
                    EditorUtility.DisplayProgressBar("Building tree", "Building game object tree. Please wait...", ((float)(objIndex + 1) * invObjCount));
                    RegisterGameObject(allWorkingObjects[objIndex]);
                }
                EditorUtility.ClearProgressBar();
            }
            else
            {
                int numObjects = allWorkingObjects.Count;
                for (int objIndex = 0; objIndex < numObjects; ++objIndex)
                {
                    RegisterGameObject(allWorkingObjects[objIndex]);
                }
            }
        }
Beispiel #4
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="octave3DMesh">
 /// The mesh associated with the tree.
 /// </param>
 public MeshSphereTree(Octave3DMesh octave3DMesh)
 {
     _octave3DMesh = octave3DMesh;
     _sphereTree   = new SphereTree <MeshSphereTreeTriangle>(2);
 }
Beispiel #5
0
 public SphereTreeNode(Sphere sphere, SphereTree <T> tree, T data = default(T))
 {
     _tree   = tree;
     _data   = data;
     _sphere = sphere;
 }