static World() { const int half = NumberOfChunksWide / 2; Max = new ChunkCoordinate(half - 1, half - 1); Min = new ChunkCoordinate(-half, -half); }
/// <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]; }
/// <summary> Tests if this ChunkCoordinate is considered equal to another. </summary> public bool Equals(ChunkCoordinate other) { return(X == other.X && Z == other.Z); }
/// <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]; }