public virtual void AddNewTokensToRepopulateGrid() { for (int x = 0; x < gameManager.gridWidth; x++) { GameObject token = gameManager.gridArray[x, gameManager.gridHeight - 1]; if (token == null) { gameManager.AddTokenToPosInGrid(x, gameManager.gridHeight - 1, gameManager.grid); } } }
//Repopulate grid at the top public virtual void AddNewTokensToRepopulateGrid() { for (int x = 0; x < gameManager.gridWidth; x++) //looping through the grid { GameObject token = gameManager.gridArray[x, gameManager.gridHeight - 1]; //find token in position if (token == null) //if there's no token there, add a token { gameManager.AddTokenToPosInGrid(x, gameManager.gridHeight - 1, gameManager.grid); } } }
/// <summary> /// Add tokens at the top of the grid. /// </summary> public virtual void AddNewTokensToRepopulateGrid() { //iterate across the top row of the grid, adding a new token in all empty spaces for (int x = 0; x < gameManager.gridWidth; x++) { GameObject token = gameManager.gridArray[x, gameManager.gridHeight - 1]; if (token == null) { gameManager.AddTokenToPosInGrid(x, gameManager.gridHeight - 1, gameManager.grid); } } }
public virtual void AddNewTokensToRepopulateGrid() { for (int x = 0; x < gameManager.gridWidth; x++) { GameObject token = gameManager.gridArray[x, gameManager.gridHeight - 1]; //took out the -1 to test and the grid didn't repopulate which is what I knew would happen, //but I'm still not sure what the -1 does. Tried it with +1 but results did not get me closer to an answer. //I'm going to come back to this when my brain isn't jello. if (token == null) { gameManager.AddTokenToPosInGrid(x, gameManager.gridHeight - 1, gameManager.grid); } } }