Exemplo n.º 1
0
    // Count holes that are cause by the new piece added to the board
    // Must be called before piece is added to board
    public static float CountNewHoles()
    {
        float holes = 0;

        // Get Lowest parts of piece
        Vector2[] pieces = Tetris._Piece.GetPieces_LowestOnes();

        // Check if tile below them are solid
        for (int i = 0; i < pieces.Length; i++)
        {
            Vector2 Check = pieces[i] + Vector2.down;

            if (!TetrisBoard.CheckInBoardRange((int)Check.x, (int)Check.y))
            {
                continue;
            }

            // If hole below them, add to counter
            if (!TetrisBoard.CheckSolid((int)Check.x, (int)Check.y))
            {
                holes++;
            }
        }

        return(holes);
    }