/// <summary> /// Method <c>GameTimer_Tick()</c> /// Represents the that should happen every timer tick. /// Ex: the _shape should move down if it can, if not a new shape /// is generated at the top. /// Checks for game over condition and calls the method that clears full /// rows. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void GameTimer_Tick(object sender, EventArgs e) { _shape.MoveDown(); if (!_shape.ValidMoveDown() && !_gameOver) { _shape.MarkPosition(); _shape = _nextShape; _shape.CenterShape(); NextBlock.Clear(); _nextShape = _shapeFactory.BuildRandomShape(); NextBlock.AddRange(_nextShape.ShapeBlocks); Blocks.AddRange(_shape.ShapeBlocks); if (GameOverCondition()) { _gameOver = true; _timer.Stop(); GameOver gameOverWindow = new GameOver(); gameOverWindow.ShowDialog(); } CheckForPoints(); } }