Example #1
0
 public void resetMap()
 {
     resetAllStats();
     map = new Tile[MapGenerator.BoardWidth, MapGenerator.BoardHeight];
     for (int x = 0; x < MapGenerator.BoardWidth; x++)
     {
         for (int y = 0; y < MapGenerator.BoardHeight; y++)
         {
             Tile tileAtPoint = MapGenerator.getTileAtPoint(x, y);
             Tile newTile = new Tile();
             newTile.setTileType(tileAtPoint.getCurrentTileType());
             if (tileAtPoint.getCurrentEntity() != null)
             {
                 Entity newEntity = null;
                 if (tileAtPoint.getCurrentEntity() is King)
                 {
                     newEntity = new King();
                 }
                 else
                 {
                     newEntity = new Minion();
                 }
                 newEntity.entityType = tileAtPoint.getCurrentEntity().entityType;
                 if (checkEntityIsFriendly(newEntity))
                 {
                     friendlyEntities.Add(newEntity);
                 }
                 else if (checkEntityIsEnemy(newEntity))
                 {
                     enemyEnities.Add(newEntity);
                 }
                 newTile.setEntity(newEntity);
             }
             if (checkEntityIsEnemy(tileAtPoint.currentTileType))
             {
                 tilesControlled++;
             }
             if (checkEntityIsFriendly(tileAtPoint.currentTileType))
             {
                 enemyTilesControlled++;
             }
         }
     }
 }