Example #1
0
        private void updateRobot(float deltaTime)
        {
            if (robot.Lives <= 0)
                state = GameState.GameOver;

            robot.Update (deltaTime);
            if (robot.Jumped)
                currentCharacterSprite = PictureManager.Pictures ["character_jumped"];
            else if (!robot.Jumped && !robot.Ducked)
                currentCharacterSprite = anim.Image;

            foreach (var projectile in robot.Projectiles) {
                if (projectile.Visible)
                    projectile.Update (new List<Enemy> {hb});
                else
                    robot.Projectiles.Remove (projectile);
            }

            if (robot.x < 500)
                state = GameState.GameOver;
        }
Example #2
0
 /// <summary>
 /// Called when the state is ready and starts the game upon a tap.
 /// </summary>
 /// <param name="touchEvents">Touch events.</param>
 private void updateReady(List<TouchEvent> touchEvents)
 {
     if (touchEvents.Count > 0)
         state = GameState.Ready;
 }
Example #3
0
 /// <summary>
 /// Pause the game.
 /// </summary>
 public override void Pause()
 {
     if (state == GameState.Running)
         state = GameState.Paused;
 }
Example #4
0
 /// <summary>
 /// Resume the game.
 /// </summary>
 public override void Resume()
 {
     if (state == GameState.Paused)
         state = GameState.Running;
 }
Example #5
0
 public GameState(GameState gameState)
 {
     Units = gameState.Units;
     GameBoard = gameState.GameBoard;
 }