上QQ阅读APP看书,第一时间看更新
- Modify the
Update()
method of the Game1 class by replacing the currentcase
statement for theGameState.Playing
state with:case GameStates.Playing: timeSinceLastInput += (float)gameTime.ElapsedGameTime.TotalSeconds; if (gameBoard.ArePiecesAnimating()) { gameBoard.UpdateAnimatedPieces(); } else { gameBoard.ResetWater(); for (int y = 0; y < GameBoard.GameBoardHeight; y++) { CheckScoringChain(gameBoard.GetWaterChain(y)); } gameBoard.GenerateNewPieces(true); if (timeSinceLastInput >= MinTimeSinceLastInput) { HandleMouseInput(Mouse.GetState()); } } break;
This method is very similar to its previous incarnation. In this instance, we check to see if there are outstanding animated pieces to process. If there are, UpdateAnimatedPieces()
is run. If no animated pieces currently exist, the previous behaviour of the GameStates.Playing
case is executed.