/// <summary> /// Loop principal do jogo /// </summary> public void Update() { try{ while (true) { board.ClearBlock(currentBlock); if (currentBlock == null) { currentBlock = nextBlock; nextBlock = new Block((board.Width / 2) - 2, 0); if (!board.ValidBlockLocation(nextBlock, nextBlock.PosX, nextBlock.PosY)) { this.gameOver = true; update.Interrupt(); } } MoveBlock(); Thread.Sleep(400); board.DrawBlock(currentBlock); if (sendNextBlock) { Console.SetCursorPosition(0, board.Height + 4); Console.Write("Checking full lines"); this.points += (board.CheckFullLine(currentBlock.PosY) * basePoints); sendNextBlock = false; currentBlock = null; } board.DrawBoard(); board.DrawScore(this.points); board.DrawNextBlock(nextBlock); Thread.Sleep(5); } }catch (Exception) {} }