コード例 #1
0
ファイル: NPC.java プロジェクト: Sundays211/VirtueRS3
  /* (non-Javadoc)
   * @see org.virtue.game.entity.Entity#process()
   */
  @Override
  public void process() {
    if (owner != null) {
      if (!owner.exists()) {
        this.destroy();
      }
    }
    if (respawnTime > 0) {
      respawnTime--;
    } else if (respawnTime == 0) {
      respawn();
      respawnTime = -1;
    }
    if (!this.exists()) {
      return;
    }
    if (canWalk()) {
      processRandomWalk();
    }

    if (currentAction != null) {
      try {
        if (currentAction.process(this)) {
          currentAction.stop(this);
          currentAction = null;
        }
      } catch (RuntimeException ex) {
        logger.error("Error running action for npc " + typeId, ex);
        currentAction = null;
      }
    }
    super.process();
  }
コード例 #2
0
ファイル: NPC.java プロジェクト: Sundays211/VirtueRS3
 /* (non-Javadoc)
  * @see org.virtue.game.entity.Entity#stopAll()
  */
 @Override
 public void stopAll() {
   super.stopAll();
   if (currentAction != null) {
     currentAction.stop(this);
     currentAction = null;
   }
 }