public void StartGame() { tetrominosOnScreen = new Collection <Tetromino>(); tetrominoQueue = new Queue <Tetromino>(); currentTetromino = null; Score = 0; DropNewTetromino(); StartTimer(); RedrawBoard(); }
protected virtual void RedrawBoardCore() { ClearCanvas(); foreach (var tetrominoOnScreen in tetrominosOnScreen) { tetrominoOnScreen.Draw(); } currentTetromino.Draw(); if (tetrominoQueue.Count > 0) { Tetromino nextTetromino = tetrominoQueue.Peek(); foreach (var block in nextTetromino.Blocks) { block.Column += previewOffset; block.Draw(this, Color.FromArgb(75, nextTetromino.Color)); block.Column -= previewOffset; } } }
public Tetromino GetRandomTetromino() { int randomNumber = random.Next(1, 8); Tetromino randomTetromino = null; switch (randomNumber) { case 1: randomTetromino = new ITetromino(this, tetrominosOnScreen); break; case 2: randomTetromino = new JTetromino(this, tetrominosOnScreen); break; case 3: randomTetromino = new OTetromino(this, tetrominosOnScreen); break; case 4: randomTetromino = new ZTetromino(this, tetrominosOnScreen); break; case 5: randomTetromino = new STetromino(this, tetrominosOnScreen); break; case 6: randomTetromino = new LTetromino(this, tetrominosOnScreen); break; case 7: randomTetromino = new TTetromino(this, tetrominosOnScreen); break; default: randomTetromino = new ITetromino(this, tetrominosOnScreen); break; } return(randomTetromino); }