public List<List<GameObject>> GetGridData()
{
List<List<GameObject>> grids = new List<List<GameObject>>();
for(int i=0;i<m_gridNumVer;i++)
grids.Add(new List<GameObject>());
int index = 0; //index of grid in m_grids
for(int row=0;row<m_gridNumVer;row++){
int numNodes = (row%2 == 0)?m_gridNumHor:m_gridNumHor-1;
for(int col=0;col<numNodes;col++){
grids[row].Add(m_grids[index]);
index ++;
}
}
if(index != m_grids.Count)
throw new DataMisalignedException("Wrong number of grids in returned data");
//if something goes wrong in this method, the index will simply not match up
//the program will throw an exception
return grids;
}