Ejemplo n.º 1
0
 protected boolean interpolatePath() {
   long timeNow = System.currentTimeMillis();
   PathLocAndDir locAndDir = pathState.interpolatePath(timeNow);
   long oid = obj.getOid();
   //         if (locAndDir != null) {
   //             if (Log.loggingDebug) {
   //                 Log.debug("BaseBehavior.interpolatePath: oid = " + oid + "; loc = " +
   // locAndDir.getLoc() + "; dir = " + locAndDir.getDir());
   //             }
   //         }
   //         else {
   //             if (Log.loggingDebug)
   //                 Log.debug("BaseBehavior.interpolatePath: oid = " + oid + "; locAndDir is
   // null");
   //         }
   if (locAndDir == null) {
     // We have arrived - - turn off interpolation, and cancel that path
     interpolatingPath = false;
     if (Log.loggingDebug)
       Log.debug(
           "BaseBehavior.interpolatePath: cancelling path: oid = "
               + oid
               + "; myLoc = "
               + obj.getWorldNode().getLoc());
     cancelPathInterpolator(oid);
     obj.getWorldNode().setDir(new MVVector(0, 0, 0));
   } else {
     obj.getWorldNode()
         .setPathInterpolatorValues(
             timeNow, locAndDir.getDir(), locAndDir.getLoc(), locAndDir.getOrientation());
     MobManagerPlugin.getTracker(obj.getInstanceOid()).updateEntity(obj);
   }
   return interpolatingPath;
 }
Ejemplo n.º 2
0
 protected long setupPathInterpolator(
     long oid, Point myLoc, Point dest, boolean follow, boolean followsTerrain) {
   long timeNow = System.currentTimeMillis();
   WorldManagerClient.MobPathReqMessage reqMsg =
       pathState.setupPathInterpolator(timeNow, myLoc, dest, mobSpeed, follow, followsTerrain);
   if (reqMsg != null) {
     try {
       Engine.getAgent().sendBroadcast(reqMsg);
       if (Log.loggingDebug)
         Log.debug("BaseBehavior.setupPathInterpolator: send MobPathReqMessage " + reqMsg);
     } catch (Exception e) {
       throw new RuntimeException(e);
     }
     interpolatingPath = true;
     return pathState.pathTimeRemaining();
   } else {
     interpolatingPath = false;
     return 0;
   }
 }