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; }
|
public Camera Camera { get; }
|
||||||
|
|
||||||
// Size of World in pixels.
|
// Size of World in pixels.
|
||||||
public int Width {
|
public readonly int Width;
|
||||||
get { return gridWidth * TileSize; }
|
public readonly int Height;
|
||||||
}
|
|
||||||
|
|
||||||
public int Height {
|
|
||||||
get { return gridHeight * TileSize; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public World(GraphicsDevice graphics, string json) {
|
public World(GraphicsDevice graphics, string json) {
|
||||||
Camera = new Camera();
|
Camera = new Camera();
|
||||||
LinesOfSight = new LinesOfSight(graphics);
|
LinesOfSight = new LinesOfSight(graphics);
|
||||||
|
|
||||||
JObject root = JObject.Parse(json);
|
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> hazardTiles = new List<Tile>();
|
||||||
List<Tile> obstacleTiles = new List<Tile>();
|
List<Tile> obstacleTiles = new List<Tile>();
|
||||||
|
Loading…
Reference in New Issue
Block a user