Пример #1
0
    /*List<int> yCoordinates = SubBlockRow.GetAllRowsYCoordinates(grid, false);
     * foreach (int y in yCoordinates)
     * {
     *  //Debug.WriteLine("test56");
     *  if (y < minimumY)
     *  {
     *      SubBlockRow subBlockRow = new SubBlockRow(y, grid);
     *
     *      Debug.WriteLine("test56");
     *      subBlockRow.Fall();
     *      Debug.WriteLine("test57");
     *  }
     * } */

    private void RemoveFullRows()
    {
        List <int> yCoordinates = SubBlockRow.GetAllRowsYCoordinates(grid, true);

        foreach (int y in yCoordinates)
        {
            SubBlockRow subBlockRow = new SubBlockRow(y, grid);
            if (subBlockRow.IsRowFull())
            {
                Debug.WriteLine("test1");
                subBlockRow.ClearRow();
                MakeRowsFall(y);

                score += 30;
            }
        }
    }
Пример #2
0
    public static List <int> GetAllRowsYCoordinates(TetrisGrid grid, bool isFullOnly)
    {
        List <int> rows = new List <int>();

        for (int y = 0; y < grid.height; y++)
        {
            SubBlockRow row = new SubBlockRow(y, grid);
            if (isFullOnly)
            {
                if (row.IsRowFull())
                {
                    rows.Add(y);
                }
            }
            else
            {
                if (!row.IsRowEmpty())
                {
                    rows.Add(y);
                }
            }
        }
        return(rows);
    }