I generated a grid, the row starts at bottom left to right and continues to generate as 5*5 grid. But i need a little help in generating grid where pattern should be as,
start row at bottom left to right, right to left. Here is the link to visual, https://dl.dropboxusercontent.com/u/102812893/grid.png How to generate this pattern.
Here is my code.
void drawGrid()
{
Vector3 offset = new Vector3(-col / 2.0f + 0.5f, -row / 2.0f + 0.5f, 0.0f); //(-2, -2)
gameObj = new GameObject[row, col];
int a = 1, b = 0;
for(int i = 0; i < row; i++)
{
for(int j = 0; j < col; j++)
{
gameObj[i, j] = tile;
b = a++;
gameObj[i, j].name = b.ToString();
Vector3 pos = new Vector3(j*0.905f, i*0.905f, 0f) + offset;
boardPositions.Add(pos);
//sr.WriteLine(i + "," + j + "=" +pos);
Instantiate(gameObj[i, j], pos, Quaternion.identity);
}
}
}