public TetrisBoard(IPieceGenerator generator, IPlayerInput playerInput)
        {
            PlayerInput = playerInput;
            PressTime = Enum.GetValues(typeof(InputButton)).OfType<InputButton>().ToDictionary(k => k, k => TimeSpan.Zero);

            State = TetrisGameState.NewGameState(generator);
            UpdateLevel();
        }
Beispiel #2
0
 public Game(IPieceGenerator pieceGenerator)
 {
     RowCount = 20;
     _state = GameState.Blank;
     _pieceGenerator = pieceGenerator;
 }
 public static TetrisGameState NewGameState(IPieceGenerator generator)
 {
     return new TetrisGameState(generator, 0, 0, new PieceInstance(generator.GetPiece(), 0, new Microsoft.Xna.Framework.Point(5, 0)), generator.GetPiece(), new Color[20, 10]);
 }
 public TetrisGameState(IPieceGenerator generator, int rows, int points, PieceInstance current, Piece next, Color[,] grid)
 {
     PieceGenerator = generator;
     Level = rows / 10;
     Rows = rows;
     Points = points;
     CurrentPiece = current;
     NextPiece = next;
     Grid = grid;
     IsFinished = !ValidPosition(current, grid);
 }
Beispiel #5
0
 public Tetris(IPieceGenerator pieceGenerator, IFallingPieceGenerator fallingPieceGenerator)
 {
     this.pieceGenerator        = pieceGenerator;
     this.fallingPieceGenerator = fallingPieceGenerator;
 }