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); } }
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; } }