コード例 #1
0
 void AddFigureToField()
 {
     for (int i = 0; i < CurrentFigure.Size; i++)
     {
         for (int j = 0; j < CurrentFigure.Size; j++)
         {
             if (CurrentFigure[i, j] == Block.block)
             {
                 gameField[CurrentFigure.Coord.Y + i, CurrentFigure.Coord.X + j + deltaX + 1] = CurrentFigure[i, j];
                 colorData[CurrentFigure.Coord.Y + i, CurrentFigure.Coord.X + j + deltaX + 1] = CurrentFigure.figureColor;
             }
         }
     }
     RowHandler.CheckRows(this);
 }
コード例 #2
0
        public static void CheckRows(TetrisGame game)
        {
            int multyplayer  = 0;
            int blockcounter = 0;

            for (int i = 0; i < 20; i++)
            {
                blockcounter = 0;
                for (int j = game.deltaX + 1; j < 10 + game.deltaX + 1; j++)
                {
                    if (game.gameField[i, j] == Block.block)
                    {
                        blockcounter++;
                    }
                }
                if (blockcounter == 10)
                {
                    multyplayer += 1;
                    RowHandler.DeleteRow(game, i);
                }
            }
            game.score += game.scoreDelta * multyplayer;
            game.RePrintGame();
        }