Example #1
0
        private void TryToDeleteQueuedChunks()
        {
            var chunksToRemove = ChunksToRemove.ToList();

            foreach (var chunkPosition in chunksToRemove)
            {
                if (RequestedChunks.ContainsKey(chunkPosition))
                {
                    RequestedChunks.Remove(chunkPosition);
                    ChunksToRemove.Remove(chunkPosition);
                }
                else if (LoadedChunks.ContainsKey(chunkPosition))
                {
                    var chunk = LoadedChunks[chunkPosition];
                    chunk.Remove();

                    LoadedChunks.Remove(chunkPosition);
                    ChunksToRemove.Remove(chunkPosition);
                }
                else if (!ChunksBeingGenerated.ContainsKey(chunkPosition))
                {
                    ChunksToRemove.Remove(chunkPosition);
                }
            }
        }
Example #2
0
 public bool ChunkCanBeRemoved(int x, int z)
 {
     var key = new Vector2i(x, z);
     return
         RequestedChunks.ContainsKey(key)
         || ChunksBeingGenerated.ContainsKey(key)
         || LoadedChunks.ContainsKey(key);
 }
Example #3
0
    /// <summary>
    /// Chunks the can be added.
    /// </summary>
    /// <returns><c>true</c>, if can be added was chunked, <c>false</c> otherwise.</returns>
    /// <param name="x">The x coordinate.</param>
    /// <param name="z">The z coordinate.</param>
    public bool                     ChunkCanBeAdded(int x, int z)
    {
        var key = new XVec2I(x, z);

        return
            (!(RequestedChunks.ContainsKey(key) ||
               ChunksBeingGenerated.ContainsKey(key) ||
               LoadedChunks.ContainsKey(key)));
    }