From a4802031d59f9aa0f9ed3624d4dfcea3d1cade66 Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Tue, 10 Mar 2020 17:32:33 -0400 Subject: [PATCH] World: load size directly from JSON. --- Shared/World.cs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Shared/World.cs b/Shared/World.cs index f3a2cbe..dbfa25a 100644 --- a/Shared/World.cs +++ b/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(); + Height = root.SelectToken("height").Value(); List hazardTiles = new List(); List obstacleTiles = new List();