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; }
/// <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; }
/// <summary> /// Pause the game. /// </summary> public override void Pause() { if (state == GameState.Running) state = GameState.Paused; }
/// <summary> /// Resume the game. /// </summary> public override void Resume() { if (state == GameState.Paused) state = GameState.Running; }
public GameState(GameState gameState) { Units = gameState.Units; GameBoard = gameState.GameBoard; }