示例#1
0
 private void InitiateCourseToTargetVia(Vector3 obstacleDetour) {
     D.Log("{0} initiating course to target {1} at {2} via obstacle detour {3}. Distance to detour = {4}.",
         _ship.FullName, DestinationInfo.Target.FullName, DestinationInfo.Destination, obstacleDetour, Vector3.Distance(obstacleDetour, _ship.Data.Position));
     DisengageAutoPilot();   // can be called while already engaged
     // even if this is an obstacle that has appeared on the way to another obstacle detour, go around it, then try direct to target
     Job obstacleAvoidanceJob = new Job(EngageDirectCourseTo(obstacleDetour), toStart: true);
     _pilotJob = obstacleAvoidanceJob;
     Job proceedToTargetJob = new Job(EngageDirectCourseToTarget(), toStart: false, onJobComplete: (wasKilled) => {
         if (!wasKilled) {
             OnDestinationReached();
         }
     });
     _pilotJob.AddChildJob(proceedToTargetJob);
 }