public static void Step(Chunk chunk) { for (var x = 0; x < ChunkWidth; x++) { for (var y = 0; y < ChunkHeight; y++) { TileHelper.Step(chunk, x, y); } } }
public static void Draw(SpriteBatch batch, Chunk chunk) { //batch.Draw(Sprites.Rectangle,new Rectangle(chunk.Position.ToPoint(),new Point(32*8,96*8)), Color.White); for (var x = 0; x < ChunkWidth; x++) { for (var y = 0; y < ChunkHeight; y++) { TileHelper.Draw(batch, chunk, x, y); } } }
public static void GenerateChunk(WorldType worldType, Chunk chunk) { for (var i = 0; i < Chunk.ChunkWidth; i++) { var n = NoiseGenerator.GenIntNoise(chunk.Position.X + i, Chunk.ChunkHeight * 10) + Chunk.ChunkHeight * 2; for (var j = Chunk.ChunkHeight - 1; j > chunk.WorldToChunk(new Vector2(n)).Y; j--) { if (i > Chunk.ChunkWidth || j < 0) { continue; } var pos = new Point(i, j); var worm = chunk.Position + pos.ToVector2(); TileHelper.TryMakeTile((int)TileTypeFromWorldNoise(n, worm.X, worm.Y), 0, (int)Color.White.PackedValue, 0, chunk, pos); } } }
public void RemoveTile(Point chunkpos) { if (!PointValid(chunkpos)) { return; } var data = Tiles[chunkpos.X, chunkpos.Y, ChunkTData]; if (data == 0) { return; } TileHelper.UpdateNearbyTiles(ChunkToWorld(chunkpos)); Tiles[chunkpos.X, chunkpos.Y, ChunkTData] = 0; Tiles[chunkpos.X, chunkpos.Y, ChunkTSide] = 0; Tiles[chunkpos.X, chunkpos.Y, ChunkTColor] = 0; Tiles[chunkpos.X, chunkpos.Y, ChunkTMeta] = 0; }