public Unit AddUnitToCell(HexCoordinates hcoords, Unit unit, int layer) { int index = hcoords.X + hcoords.Z * width + hcoords.Z / 2; // translate the X,Y,Z coordinates into the cells[] single-dimention array HexCell cell = cells[index]; // lookup HexCell object from it's cells[] index return(cell.AddStackableUnit(unit, layer)); }