Esempio n. 1
0
 IEnumerator RenderChunks()
 {
     while (true)
     {
         if (chunksToRender.Count > 0)
         {
             var chunk    = chunksToRender.Peek();
             var distance = playerChunkPosition.ManhattanDistance(chunk.chunkPosition);
             if (distance < generatedDistance)
             {
                 currentlyRenderingLayer = distance;
                 chunksToRender.Dequeue().UpdateMesh();
             }
         }
         // One chunk rendered, yield to prevent frame freeze
         yield return(null);
     }
 }