private void loadMapFromXml()
{
CellMapXMLContainer container = MapSaveLoad.Load("map.xml");
mapSize = container.size;
//initially remove all children
for (int i = 0; i < mapTransform.childCount; i++)
{
Destroy(mapTransform.GetChild(i).gameObject);
}
map = new List<List<Cell>>();
for (int i = 0; i < mapSize; i++)
{
List<Cell> row = new List<Cell>();
for (int j = 0; j < mapSize; j++)
{
Cell cell = ((GameObject)Instantiate(PrefabHolder.instance.BASE_TILE_PREFAB, new Vector3(i - Mathf.Floor(mapSize / 2), 0, -j + Mathf.Floor(mapSize / 2)), Quaternion.Euler(new Vector3()))).GetComponent<Cell>();
cell.transform.parent = mapTransform;
cell.gridPosition = new Vector2(i, j);
cell.type = (CellType)(container.cells.Where(x => x.locX == i && x.locY == j).First().id);
row.Add(cell);
}
map.Add(row);
}
}