本文整理汇总了C#中Job.AddChildJob方法的典型用法代码示例。如果您正苦于以下问题:C# Job.AddChildJob方法的具体用法?C# Job.AddChildJob怎么用?C# Job.AddChildJob使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Job
的用法示例。
在下文中一共展示了Job.AddChildJob方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitiateCourseToTargetVia
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);
}