public void removeRow(int row) { // First delete the row and set the grid to null for this row. for (int x = 0; x < width; x++) { // Old code, doesn't use animationQueue //m_allGamePieces [x, row].FadeOut (fadeTime); animationQueue.addFadeAnimationBatch(m_allGamePieces[x, row], fadeTime, 3, width); m_allGamePieces[x, row] = null; } // Then move the next row if (row != height - 1) { for (int y = row + 1; y < height; y++) { int tempRowCounter = 0; for (int x = 0; x < width; x++) { // First count the amount of pieces per row we need to move if (m_allGamePieces[x, y] != null) { tempRowCounter++; } } for (int x = 0; x < width; x++) { // Then actually move the moves per group (use tempRowCounter as groupsize) if (m_allGamePieces[x, y] != null) { // Try moving row by row animationQueue.addMoveAnimationBatch(m_allGamePieces[x, y], moveTime, new Vector3(x, (y - 1), 0), tempRowCounter); // Old code for moving piece by piece // animationQueue.addMoveAnimation(m_allGamePieces[x, y], moveTime, new Vector3(x, (y - 1), 0)); // Now update the matrix m_allGamePieces[x, (y - 1)] = m_allGamePieces[x, y]; m_allGamePieces[x, (y - 1)].xIndex = x; // This is probably not needed m_allGamePieces[x, (y - 1)].yIndex = y - 1; // Set the previous one to null m_allGamePieces[x, y] = null; } } } } // Now add a new row for (int x = 0; x < width; x++) { PlaceRandomPiece(x, height - 1, 0, fadeTime); } // Now increase the score // Update the score ScoreManager scoreManager = (ScoreManager)score.GetComponent(typeof(ScoreManager)); scoreManager.AddScore(rowIncrease); }