Browse Source

World: load size directly from JSON.

master
Colin McMillen 4 years ago
parent
commit
a4802031d5
  1. 11
      Shared/World.cs

11
Shared/World.cs

@ -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>();

Loading…
Cancel
Save