示例#1
0
  @Override
  public void mouseClick(int x, int y) {
    MapNode n = map.getMapNode(grid.getHoverx(), grid.getHovery());

    if (n.actionSquare()) {
      Btlshp.getGame().outputMessage("Fire gun action.");
      Location loc = new Location(grid.getHoverx(), grid.getHovery());
      map.fireGuns(ship, loc);
      Btlshp.getGame().sendTurn(TurnFactory.shoot(ship, loc));
    }
    grid.cancelAction();
  }
示例#2
0
  @Override
  public void highlightCells() {
    super.highlightCells();

    NodeIterator it = ship.getFiringIterator();
    it.iterate(
        map,
        ship.getLocation(),
        ship.getDirection(),
        new NodeIteratorAction() {
          @Override
          public void visit(MapNode n, Block b) {
            if (n == null) return;
            n.actionArea(true);
          }
        });

    MapNode n = map.getMapNode(grid.getHoverx(), grid.getHovery());

    if (n != null) {
      if (n.actionArea()) n.actionSquare(true);
      else n.badAction(true);
    }
  }