Example #1
0
    private static void checkForDestroys()
    {
        /*
         * int i = -1;
         * for (Chunk chunk = InfiniteWorld.GetFromRemoveQueue(); chunk != null; chunk = InfiniteWorld.GetFromRemoveQueue())
         * {
         *  Destroy(chunk.chunk);
         *  i++;
         *  if (i >= 1) { break; }
         * }
         */

        for (Chunk chunk = MeshGeneration.GetFromRemoveQueue(); chunk != null; chunk = MeshGeneration.GetFromRemoveQueue())
        {
            if (chunk != null)
            {
                Destroy(chunk.chunk);
            }
        }

        /*
         * Chunk chunk = MeshGeneration.GetFromRemoveQueue();
         * if (chunk != null)
         * {
         *  Destroy(chunk.chunk);
         * }
         */
    }
    private static void checkForDestroys()
    {
        /*
         * int i = -1;
         * for (Chunk chunk = InfiniteWorld.GetFromRemoveQueue(); chunk != null; chunk = InfiniteWorld.GetFromRemoveQueue())
         * {
         *  Destroy(chunk.chunk);
         *  i++;
         *  if (i >= 1) { break; }
         * }
         */

        //for (int i = 0; i < destroysPerFrame; i++)
        //{

        Chunk chunk;// = MeshGeneration.GetFromRemoveQueue(); //; chunk != null; chunk = MeshGeneration.GetFromRemoveQueue()

        while ((chunk = MeshGeneration.GetFromRemoveQueue()) != null)
        {
            if (chunk.chunk == null)
            {
                unneededDeletes++;
                Debug.Log("unneeded deletes: " + unneededDeletes);
                continue;
            }
            //Debug.Log("asdklöfj: " + chunk);
            //Debug.Log("name: " + chunk.chunk.name);
            Destroy(chunk.chunk);
            // //Destroy(chunk.chunk);
            //chunk = MeshGeneration.GetFromRemoveQueue();
        }
        //}

        /*
         * for (int i = 0; i < destroysPerFrame; i++)
         * {
         *  Chunk chunk = MeshGeneration.GetFromRemoveQueue();
         *
         *  if (chunk.chunk != null)
         *  {
         *      Debug.Log("Removing " + chunk);
         *      Destroy(chunk.chunk);
         *  }
         *  else
         *  {
         *      break;
         *  }
         * }
         */
    }