Ejemplo n.º 1
0
  /**
   * Return game info.
   *
   * @return game info.
   */
  @RequestMapping("/game/")
  @ResponseBody
  public GameStateInfo getGameInfo() {

    final Iterable<GameBubble> bubbles = gameWorld.getBubbles();

    final GameStateInfo info = new GameStateInfo();
    info.setBubbles(bubbles);
    return info;
  }
Ejemplo n.º 2
0
  /**
   * Perform game turn.
   *
   * @param turnCommand command to perform turn
   * @return turn result
   */
  @RequestMapping(value = "/game/turn.do" /*, method = RequestMethod.POST*/)
  @ResponseBody
  public TurnResult doTurn(@Valid TurnCommand turnCommand) {
    physicProcessor.fire(turnCommand.getAngle());
    physicProcessor.runPhysics();

    final Iterable<ContactInfo> contacts = physicProcessor.processContactsHistory();

    final TurnResult result = new TurnResult();
    result.setSuccess(true);
    result.setContacts(contacts);
    result.setBubbles(gameWorld.getBubbles());
    return result;
  }