Ejemplo n.º 1
0
    void PerformNextDownwardMove()
    {
        if (currentBlock == null)
        {
            return;
        }

        bool blockCanKeepMoving = false;
        bool shouldUpdateBoard  = true;

        blockCanKeepMoving = currentBlock.MoveDown(tetrisBoard);
        if (!blockCanKeepMoving)
        {
            if (currentBlock.IsBlockAbovePlayArea(boardSizeY))
            {
                LoseGame();
            }
            tetrisBoard = currentBlock.AddToBoard(tetrisBoard);
            soundEngine.PlaySoundWithName("BlockLand");
            currentBlock = null;
            if (CheckForCompleteLines() || CheckForCompleteColumns())
            {
                gameStepTimer    += lineCompleteHangDuration;
                shouldUpdateBoard = false;
            }
        }

        if (shouldUpdateBoard)
        {
            display.UpdateBoard(tetrisBoard, currentBlock);
        }
    }