Esempio n. 1
0
        /// <summary>
        /// Returns a chunk
        /// </summary>
        /// <returns></returns>
        private Chunk FetchChunk(int chunkX, int chunkY)
        {
            ObjectAccess <Chunk> storage = this.Chunks[chunkX, chunkY];

            storage.Recorder.Access();

            if (storage.Object == null)
            {
                return(WorldStorage.ChunkStorage.LoadChunk(chunkX, chunkY, this.DimensionID));
            }
            else
            {
                return(storage.Object);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Attempts to return a structure. Returns null if no structure was found.
        /// </summary>
        /// <returns></returns>
        public Structure GetStructure(Guid structureID)
        {
            ObjectAccess <Structure> storage = this.StructureStorage[structureID];

            storage.Recorder.Access();

            if (storage.Object == null)
            {
                return(WorldStorage.StructureStorage.LoadStructure(structureID, this.DimensionID));
            }
            else
            {
                return(storage.Object);
            }
        }
Esempio n. 3
0
        public IEnumerator <Tile> GetEnumerator()
        {
            for (int x = 0; x < this.Width; x++)
            {
                for (int y = 0; y < this.Height; y++)
                {
                    ObjectAccess <Chunk> item = this.Chunks[x, y];

                    if (item.Object == null)
                    {
                        this.Chunks[x, y].Object = this.FetchChunk(x, y);
                    }

                    foreach (Tile item2 in item.Object)
                    {
                        yield return(item2);
                    }
                }
            }
        }