From 4299a009b7bf8d3f6a98f1c284ae3632dd618e62 Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Tue, 3 Mar 2020 13:08:51 -0500 Subject: [PATCH] use auto property --- Shared/World.cs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Shared/World.cs b/Shared/World.cs index 0f9ccd2..1a8704c 100644 --- a/Shared/World.cs +++ b/Shared/World.cs @@ -90,17 +90,13 @@ namespace SemiColinGames { public const int TileSize = 16; readonly Tile[] tiles; readonly Tile[] decorations; - - Player player; readonly NPC[] npcs = new NPC[1]; // Size of World in terms of tile grid. private readonly int tileWidth; private readonly int tileHeight; - public Player Player { - get { return player; } - } + public Player Player { get; private set; } // Size of World in pixels. public int Width { @@ -112,7 +108,7 @@ namespace SemiColinGames { } public World(string levelSpecification) { - player = new Player(); + Player = new Player(); npcs[0] = new NPC(new Point(16 * 38, 16 * 12)); var tilesList = new List(); var decorationsList = new List(); @@ -162,17 +158,17 @@ namespace SemiColinGames { } public void Update(float modelTime, History input) { - player.Update(modelTime, input, CollisionTargets); + Player.Update(modelTime, input, CollisionTargets); foreach (NPC npc in npcs) { npc.Update(modelTime); } - if (player.Health <= 0) { + if (Player.Health <= 0) { Reset(); } } void Reset() { - player = new Player(); + Player = new Player(); } public void DrawBackground(SpriteBatch spriteBatch) {