public void TransformScene(uint value, MonoBehaviour behavior)
 {
     if (value < allScenes.Count)
     {
         SceneStreaming str = allScenes[(int)value];
         if (str.state == SceneStreaming.State.Loaded)
         {
             // str.DeleteSync();
             behavior.StartCoroutine(str.Delete());
         }
         else if (str.state == SceneStreaming.State.Unloaded)
         {
             // str.GenerateSync();
             behavior.StartCoroutine(str.Generate());
         }
     }
 }
Esempio n. 2
0
        //Press number load scene

        public static void Update(MonoBehaviour behavior)
        {
            /* int value;
             * if (int.TryParse(Input.inputString, out value) && value < testNodeArray.Length)
             * {
             *   Random rd = new Random((uint)Guid.NewGuid().GetHashCode());
             *   addList.Add(testNodeArray[value]);
             *   TerrainQuadTree.QuadTreeNode* node = (TerrainQuadTree.QuadTreeNode*)testNodeArray[value];
             *   if (node->listPosition < 0)
             *   {
             *       NativeArray<float> heightMap = new NativeArray<float>(commonData.terrainDrawStreaming.heightMapSize, Allocator.Temp);
             *       for(int i = 0; i < heightMap.Length; ++i)
             *       {
             *           heightMap[i] = (float)(rd.NextDouble() * 0.2);
             *       }
             *       commonData.terrainDrawStreaming.AddQuadTrees(addList, heightMap);
             *
             *   }
             *   else
             *   {
             *       commonData.terrainDrawStreaming.RemoveQuadTrees(addList);
             *   }
             *   addList.Clear();
             * }
             */

            int value;

            if (int.TryParse(Input.inputString, out value))
            {
                if (value < allScenes.Count)
                {
                    SceneStreaming str = allScenes[value];
                    if (str.state == SceneStreaming.State.Loaded)
                    {
                        behavior.StartCoroutine(str.Delete());
                    }
                    else if (str.state == SceneStreaming.State.Unloaded)
                    {
                        behavior.StartCoroutine(str.Generate());
                    }
                }
            }
        }
        //Press number load scene
        private void Update()
        {
            int value;

            if (int.TryParse(Input.inputString, out value))
            {
                if (value < allScenes.Count)
                {
                    SceneStreaming str = allScenes[value];
                    if (str.state == SceneStreaming.State.Loaded)
                    {
                        StartCoroutine(str.Delete());
                    }
                    else if (str.state == SceneStreaming.State.Unloaded)
                    {
                        StartCoroutine(str.Generate());
                    }
                }
            }
        }
        private void Update()
        {
            int value;

            if (int.TryParse(Input.inputString, out value))
            {
                if (value < allScenes.Count)
                {
                    SceneStreaming str = allScenes[value];
                    if (str.state == SceneStreaming.State.Loaded)
                    {
                        StartCoroutine(str.Delete());
                    }
                    else if (str.state == SceneStreaming.State.Unloaded)
                    {
                        StartCoroutine(str.Generate());
                    }
                }
            }
            lock (SceneStreaming.commandQueue)
            {
                SceneStreaming.commandQueue.Run(ref data.baseBuffer, data.resources);
            }
        }