public void UpdateTiles(GameTime gameTime)
{
//Keep a tile variable handy so we don't have to make multiple requests to get one
Tile tile;
//Update Background Blocks
for (int x = (int)MainCamera.Left / Tile.Width; x <= (int)MainCamera.Right / Tile.Width; x++)
{
for (int y = ((int)MainCamera.Bottom / Tile.Height); y >= (int)MainCamera.Top / Tile.Height; y--)
{
if (InDrawBounds(x, y))
{
tile = Tiles[x, y, 0];
if (tile.Block != BlockType.Empty)
{
tile.Update(gameTime);
}
}
}
}
//Update Foreground Blocks
for (int x = (int)MainCamera.Left / Tile.Width; x <= (int)MainCamera.Right / Tile.Width; x++)
{
for (int y = ((int)MainCamera.Bottom / Tile.Height); y >= (int)MainCamera.Top / Tile.Height; y--)
{
if (InDrawBounds(x, y))
{
tile = Tiles[x, y, 1];
if (tile.Block != BlockType.Empty)
{
tile.Update(gameTime);
}
}
}
}
}