protected Animation(float _duration, GameField.BlockType _type) { duration = _duration; type = _type; timeElapsed = 0; }
private void destroyChains() { bool[,] destroyed = new bool[FIELD_SIZE, FIELD_SIZE]; for (int i = 0; i < FIELD_SIZE; ++i) { GameField.BlockType[] row = new GameField.BlockType[FIELD_SIZE]; GameField.BlockType[] col = new GameField.BlockType[FIELD_SIZE]; for (int j = 0; j < FIELD_SIZE; ++j) { col[j] = field.Get(i, j); row[j] = field.Get(j, i); } for (int j = 0; j < FIELD_SIZE - 2; ++j) { if (col[j] != GameField.BlockType.Empty && col[j] == col[j + 1] && col[j] == col[j + 2]) { for (int k = j; k < FIELD_SIZE && col[k] == col[j]; ++k) { destroyed[i, k] = true; } } if (row[j] != GameField.BlockType.Empty && row[j] == row[j + 1] && row[j] == row[j + 2]) { for (int k = j; k < FIELD_SIZE && row[k] == row[j]; ++k) { destroyed[k, i] = true; } } } } for (int i = 0; i < FIELD_SIZE; ++i) { for (int j = 0; j < FIELD_SIZE; ++j) { if (destroyed[i, j]) { destroyOneBlock(new TableCoords(i, j)); } } } if ( info.turnMade() && ( field.IsEmpty(info.previousTurn.Value.block1) || field.IsEmpty(info.previousTurn.Value.block2) ) ) { info.previousTurn = null; } }