示例#1
0
文件: Board.cs 项目: destbg/Tetris
        private void PlaceBlock()
        {
            if (EndGame())
            {
                Game.EndGame();
                return;
            }
            cB = nB;
            preview[cB[0]][cB[1]] = new Tetromino();
            preview[cB[2]][cB[3]] = new Tetromino();
            preview[cB[4]][cB[5]] = new Tetromino();
            preview[cB[6]][cB[7]] = new Tetromino();
            while (cB[6] < 3)
            {
                cB[0]++;
                cB[2]++;
                cB[4]++;
                cB[6]++;
            }
            if (move > 3)
            {
                move = 3;
            }
            else if (move < -2 && cB[8] == 3)
            {
                move = -2;
            }
            else if (move < -3)
            {
                move = -3;
            }
            cB[1] += move;
            cB[3] += move;
            cB[5] += move;
            cB[7] += move;
            nB     = block.GetBlock();
            var b = nB[8];

            preview[nB[0]][nB[1]] = new Tetromino(true, b);
            preview[nB[2]][nB[3]] = new Tetromino(true, b);
            preview[nB[4]][nB[5]] = new Tetromino(true, b);
            preview[nB[6]][nB[7]] = new Tetromino(true, b);
            PreviewTrue();
            Borders();
        }
示例#2
0
        private void PlaceTetramino(bool instantly)
        {
            if (instantly)
            {
                MoveDownInstantly();
            }
            foreach (Unit unit in currentTetramino.Units)
            {
                cells[unit.Row][unit.Column].TransformToBlock();
            }

            if (EndGame(cells[4]))
            {
                Game.EndGame();
                return;
            }


            currentTetramino = manager.GetRandomTetramino();
        }