Пример #1
0
 public void RedrawAllTextures()
 {
     foreach (KeyValuePair <Vector2, TerrainChunk> kvp in terrainChunkDictionary)
     {
         TerrainChunk chunk       = kvp.Value;
         ThreadStart  threadStart = delegate {
             MapData         mapData    = chunk.GenerateMapData();
             ChunkRedrawInfo redrawInfo = new ChunkRedrawInfo(chunk, mapData.colorMap);
             lock (chunkRedrawQueue) {
                 chunkRedrawQueue.Add(redrawInfo);
             }
         };
         new Thread(threadStart).Start();
     }
     for (int i = 1; i < chunkRedrawQueue.Count; i++)
     {
         ChunkRedrawInfo info = chunkRedrawQueue [i];
         if (info.chunk != null && info.chunk.IsVisible())
         {
             chunkRedrawQueue.Remove(info);
             chunkRedrawQueue.Insert(0, info);
         }
     }
 }