public void MoveToNonSolid()
 {
     // Set Player location
     p.setLocation(new PointF(0, 1));
     // Add non-solid entity (tall grass) on location 0,0
     Entity tree = new Plant(new PointF(0, 0), (int)SPRITES.tallgrass, 50, false);
     w.addEntity(tree);
     // Try to move one grid up to tile with non-solid entity
     p.move(w, new PointF(0, -1));
     // Check if player moved
     Assert.AreEqual(new PointF(0, 0), p.getLocation());
 }
 public void DropBananaOnSolidEntity()
 {
     // Add tree on location 2, 1
     Entity tree = new Plant(new Point(1, 2), (int)SPRITES.sapling_oak, 50);
     w.addEntity(tree);
     // Add banana to players inventory
     p.AddItemToInventory(new Item(new Entity(ENTITIES.fruit, new PointF(0, 0), bananaId)));
     // Set direction to right
     p.CurrentDirection = (int)Player.Direction.Right;
     // Drop item on the right of player on 2, 1
     p.DropItem(w);
     // Check if banana still exists in inventory
     Assert.AreEqual(p.Inventory.Count, 0);
 }
        public void DropBananaOnWaterTileWithLilypad()
        {
            // Add lilypad on location 1, 2
            Entity lilypad = new Plant(new Point(1, 2), (int)SPRITES.waterlily, 50, false, 0);
            w.addEntity(lilypad);
            // Add banana to players inventory
            p.AddItemToInventory(new Item(new Entity(ENTITIES.fruit, new PointF(0, 0), bananaId)));
            // Set direction to down
            p.CurrentDirection = (int)Player.Direction.Down;
            // Drop item below player on 1, 2
            p.DropItem(w);
            // Check if banana still exists in inventory
            Assert.AreEqual(p.Inventory.Count, 0);
            //Assert.AreEqual(p.Inventory[0].Entity.getSpriteID(), bananaId);

            // Check if banana is dropped on location 1, 2
            List<Entity> entities = w.getEntitiesOnTerrainTile(new Point(1, 2))
                .Where(e => e.getSpriteID() == bananaId).ToList();
            Assert.AreEqual(entities[0].getSpriteID(), bananaId);
        }
 public void MoveToSolid()
 {
     // Set Player location
     p.setLocation(new PointF(0, 1));
     // Add solid entity (tree) on location 1,1
     Entity tree = new Plant(new PointF(1, 1), (int)SPRITES.tree1, 50);
     w.addEntity(tree);
     // Try to move one grid to the right to tile with solid entity
     p.move(w, new PointF(1, 1));
     // Check if player didn't move
     Assert.AreEqual(new PointF(0, 1), p.getLocation());
 }
 public void MoveToNonSolidOnNonWalkable()
 {
     // Set Player location
     p.setLocation(new Point(0, 1));
     // Add lilypad (walkable Entity) on location 0,2 (NonWalkable tile)
     Entity lilypad = new Plant(new Point(0, 2), (int)SPRITES.waterlily, 50, false, 0);
     w.addEntity(lilypad);
     // Try to move one grid down to water tile with lilypad
     p.move(w, new PointF(0, 1));
     // Check if player moved
     Assert.AreEqual(new PointF(0, 2), p.getLocation());
 }