예제 #1
0
  @Override
  public void execute() {

    if (!ctx.objects.select().id(Constants.ropeSwingID).isEmpty()) {
      mainScript.updateStatus("Swinging rope");
      rope = ctx.objects.shuffle().first().poll();
      rope.bounds(ropeBounds);
      ctx.camera.turnTo(rope);
      if (rope.inViewport()) {
        rope.interact("Swing-on");
      } else if (!rope.inViewport()) {
        ctx.camera.turnTo(rope);
        ctx.movement.step(startTile);
      }
    } else if (!ctx.objects.select().id(Constants.ropeLadderID).isEmpty()) {
      mainScript.updateStatus("Climbing up ladder");
      rope = ctx.objects.nearest().poll();
      rope.bounds(ladderBounds);
      ctx.camera.turnTo(rope);
      if (rope.inViewport()) {
        rope.interact("Climb-up", "Ladder");
      } else if (!rope.inViewport()) {
        ctx.camera.turnTo(rope);
        ctx.movement.step(rope);
      }
    } else {
      mainScript.log.info("Object not found");
    }
  }
예제 #2
0
 @Override
 public void repaint(Graphics g) {
   if (startTile != null && rope != null) {
     startTile.matrix(ctx).draw(g);
     rope.draw(g);
   }
 }