public static IPlayer CreatePlayer(JToken playerJToken, IEntityLocation entityLocation) { return(new Player( playerJToken["lives"].Value <int>(), new List <IWearable>(), entityLocation )); }
///<inheritdoc/> public IEnumerable <IEnemy> GetEnemiesWithinReach(IEntityLocation location) { return(Enemies.Where(enemy => enemy.Location.X == location.X + 1 && enemy.Location.Y == location.Y || enemy.Location.X == location.X - 1 && enemy.Location.Y == location.Y || enemy.Location.X == location.X && enemy.Location.Y == location.Y + 1 || enemy.Location.X == location.X && enemy.Location.Y == location.Y - 1 )); }
/// <summary> /// Creates a new instance from the provided parameters /// </summary> /// <param name="lives">The amount of lives</param> /// <param name="location">The starting location</param> protected Entity(int lives, IEntityLocation location) { _lives = lives; Location = location; }
/// <summary> /// Creates a new instance of a player based on the passed parameters /// </summary> /// <param name="lives">The amount of lives of the player</param> /// <param name="inventory">The initialized inventory of the player</param> /// <param name="location">The location of the player</param> public Player(int lives, List <IWearable> inventory, IEntityLocation location) : base(lives, location) { _inventory = inventory; }
///<inheritdoc/> public override void OnNext(IEntityLocation entityLocation) { _game.Update(); base.OnNext(entityLocation); }