예제 #1
0
        private void PrepareChunks(int MaxNumToPrepare)
        {
            UnityEngine.Debug.Log("Preparing Chunks");

            for (int i = 0; i < MaxNumToPrepare; i++)
            {
                if (RealizeList.Count == 0)
                {
                    FinishPreparing();
                    return;
                }

                Chunk c = ChunkGenerator.RealizeChunk(RealizeList.Dequeue(), ChunkPrefab, ChunkParent);
                RealizedChunks.Add(c.Key, c);
            }
        }
예제 #2
0
 private static void WorkThreadFunction()
 {
     try
     {
         Parallel.ForEach(Tasks, (ChunkJob job) => {
             Results.Add(ChunkGenerator.CreateChunk(job));
             NumDoneTasks++;
         });
         WorkState = 2;
     }
     catch (System.Exception ex)
     {
         Error     = ex.Message;
         WorkState = 3;
     }
 }