예제 #1
0
 public static IPlayer CreatePlayer(JToken playerJToken, IEntityLocation entityLocation)
 {
     return(new Player(
                playerJToken["lives"].Value <int>(),
                new List <IWearable>(),
                entityLocation
                ));
 }
예제 #2
0
 ///<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
                          ));
 }
예제 #3
0
 /// <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;
 }
예제 #4
0
 /// <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;
 }
예제 #5
0
 ///<inheritdoc/>
 public override void OnNext(IEntityLocation entityLocation)
 {
     _game.Update();
     base.OnNext(entityLocation);
 }