World: load size directly from JSON.
This commit is contained in:
parent
b85661e2c4
commit
a4802031d5
@ -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…
Reference in New Issue
Block a user