Пример #1
0
        public void update(GameTime gameTime)
        {
            currentTetromino.update(gameTime, isLeftCollide(), isRightCollide());
            if (currentTetromino.isBlockFallen() || currentTetromino.IsFallen)
            {
                fallenPieces.Add(currentTetromino);
                chooseBlock();
            }
            if (Keyboard.GetState().IsKeyDown(Keys.Up) && currentTetromino.RotateTimer <= 0 && canRotate() && currentTetromino.X + (4 - currentTetromino.emptyColumnsFromRight()) < 10)
            {
                int[] rotateArray = new int[2];
                rotateArray[0] = 1;
                rotateArray[1] = 1;

                currentTetromino.rotate();
                currentTetromino.updateBlock();
                currentTetromino.RotateTimer = 0.5d;
            }
            List <int> lineInfo = searchForLine();

            if (lineInfo[0] != 0)
            {
                for (int i = 1; i < lineInfo.Count; i++)
                {
                    removeLine(lineInfo[i]);
                }
                for (int c = 1; c < lineInfo.Count; c++)
                {
                    moveFallenBlocksDown(lineInfo[c]);
                }
            }
            if (!canRotate() && currentTetromino.Y == 0)
            {
                gameOver = true;
            }
        }