示例#1
0
        static World()
        {
            const int half = NumberOfChunksWide / 2;

            Max = new ChunkCoordinate(half - 1, half - 1);
            Min = new ChunkCoordinate(-half, -half);
        }
示例#2
0
 /// <summary> Constructor. </summary>
 /// <param name="coordinate"> The coordinate associated with the chunk. </param>
 public Chunk(ChunkCoordinate coordinate)
 {
     Coordinate = coordinate;
     Offset     = new WorldPosition(coordinate.X * Chunk.Length, coordinate.Z * Chunk.Length);
     _tiles     = new Tile[Length * Length];
 }
示例#3
0
 /// <summary> Tests if this ChunkCoordinate is considered equal to another. </summary>
 public bool Equals(ChunkCoordinate other)
 {
     return(X == other.X && Z == other.Z);
 }
示例#4
0
 /// <summary>
 ///  Re-centers the world on the given chunk, loading neighboring chunks when needed.
 /// </summary>
 /// <param name="coordinate"> The position of the chunk to make the center of the world. </param>
 private void Recenter(ChunkCoordinate coordinate)
 {
     CenterChunk = Chunks[coordinate.Index];
 }