Browse Source

use auto property

master
Colin McMillen 4 years ago
parent
commit
4299a009b7
  1. 14
      Shared/World.cs

14
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<Tile>();
var decorationsList = new List<Tile>();
@ -162,17 +158,17 @@ namespace SemiColinGames {
}
public void Update(float modelTime, History<Input> 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) {

Loading…
Cancel
Save