Beispiel #1
0
 private void OnFigureLanding()
 {
     IncreaseScore(10);
     fallingFigure         = Tetromino.CreateFigure(NextFallingFigureType, FallingFigureSpawnPosition);
     NextFallingFigureType = Tetromino.GetRandomType();
     holdButtonAlredyUse   = false;
     if (FigureLanded != null)
     {
         FigureLanded.Invoke(this, new EventArgs());
     }
 }
Beispiel #2
0
 public void StartGame()
 {
     holdButtonAlredyUse = false;
     GameIsOver          = false;
     Score      = 0;
     LinesScore = 0;
     HoldedFallingFigureType = null;
     gameField             = new Block[GameFieldSize.Width, GameFieldSize.Height];
     fallingFigure         = Tetromino.CreateRandomFigure(FallingFigureSpawnPosition);
     NextFallingFigureType = Tetromino.GetRandomType();
     OnGameStart();
 }
Beispiel #3
0
 private void HoldFallingFigure()
 {
     if (HoldedFallingFigureType != null)
     {
         var temp = fallingFigure.Type;
         fallingFigure           = Tetromino.CreateFigure(HoldedFallingFigureType.Value, FallingFigureSpawnPosition);
         HoldedFallingFigureType = temp;
     }
     else
     {
         HoldedFallingFigureType = fallingFigure.Type;
         fallingFigure           = Tetromino.CreateFigure(NextFallingFigureType, FallingFigureSpawnPosition);
     }
     NextFallingFigureType = Tetromino.GetRandomType();
     holdButtonAlredyUse   = true;
 }