Beispiel #1
0
 /// <summary>
 /// Preloads the chunk at the world quadrant.
 /// </summary>
 /// <param name="worldQuadrant">The world quadrant.</param>
 public void PreloadChunkAt(Point worldQuadrant)
 {
     // If the storage contains the chunk at worldquadrant
     if (!ChunkStorage.ContainsKey(worldQuadrant))
     {
         // Load/create missing chunk
         LoadOrCreateMissingChunk(worldQuadrant);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Gets the chunk at the world quadrant.
        /// </summary>
        /// <param name="worldQuadrant">The world quadrant.</param>
        /// <returns></returns>
        public Chunk GetChunkAt(Point worldQuadrant)
        {
            // Pre load the chunk
            PreloadChunkAt(worldQuadrant);

            // If the chunk exists in the storage
            if (ChunkStorage.ContainsKey(worldQuadrant))
            {
                // Return the chunk
                return(ChunkStorage[worldQuadrant]);
            }
            else
            {
                return(null);
            }
        }