X hits on this document

300 views

0 shares

0 downloads

0 comments

71 / 102

       {

if (gestureSample.GestureType == GestureType.FreeDrag)

               isDragging = true;

else if (gestureSample.GestureType == GestureType.DragComplete)

               isDragging = false;

           player.HandleInput(gestureSample);

       }

   }

}

All the above method does is to handle input that instructs the game to pause or end- using helper methods, which we will soon implement- and pass gesture information to the Human class for processing.

150.

Implement the following two methods in the GameplayScreen class. They will be used to pause and end the game:

C#

private void FinishCurrentGame()

{

   ExitScreen();

}

private void PauseCurrentGame()

{

   var pauseMenuBackground = new BackgroundScreen();

   ScreenManager.AddScreen(pauseMenuBackground, null);

   ScreenManager.AddScreen(new PauseScreen(pauseMenuBackground), null);

}

151.

Navigate to the “Start” method in the GameplayScreen class and uncomment the final line of code. The method should now look like this:

C#

void Start()

{

   // Set initial wind direction

   wind = Vector2.Zero;

   isHumanTurn = false;

   changeTurn = true;

   computer.Catapult.CurrentState = CatapultState.Reset;

}

Page | 71

Document info
Document views300
Page views300
Page last viewedSun Dec 11 12:29:47 UTC 2016
Pages102
Paragraphs3115
Words17333

Comments