//Events when changing figure for the next //Події при необхідності змінити фігуру на наступну public void NextTetromino() { currentTetromino = nextTetromino; currentTetromino.columns = columns; if (gameStarted) { //Check if there is space on the screen to put a new figure //перевірка, чи нова фігура поміститься на поле if (!currentTetromino.CanItFit()) { GameOver(); } } if (gameStarted) { //Stop the timer //зупинка таймера DropTimer.Stop(); comboLines = 0; //Clear filled lines //Очищення повних ліній for (int row = 0; row < rows; ++row) { if (CheckLine(row)) { ClearLine(row); ++comboLines; ++lines; } } //Refresh score //Оновлення рахунку UpdateScore(); //Refresh level //оновлення рівня UpdateLevel(); //Show score //показ тексту про рахунок DisplayInfoText(); //Draw figure //малювання фігури currentTetromino.DrawTetromino(true); //Chose next figure //вибір наступної фігури nextTetromino = GenerateTetromino(); //Clear 'next figure' window //очищення вікна наступної фігури MakeNextGlass(); //Draw next figure //малювання наступної фігури nextTetromino.DrawNext(); //Redraw screen //оновлення екрану ReDraw(); //Start timer //відновлення таймера DropTimer.Start(); } }