World: load size directly from JSON.

This commit is contained in:
Colin McMillen 2020-03-10 17:32:33 -04:00
parent b85661e2c4
commit a4802031d5

View File

@ -25,19 +25,16 @@ namespace SemiColinGames {
public Camera Camera { get; }
// Size of World in pixels.
public int Width {
get { return gridWidth * TileSize; }
}
public int Height {
get { return gridHeight * TileSize; }
}
public readonly int Width;
public readonly int Height;
public World(GraphicsDevice graphics, string json) {
Camera = new Camera();
LinesOfSight = new LinesOfSight(graphics);
JObject root = JObject.Parse(json);
Width = root.SelectToken("width").Value<int>();
Height = root.SelectToken("height").Value<int>();
List<Tile> hazardTiles = new List<Tile>();
List<Tile> obstacleTiles = new List<Tile>();