/// <summary>Calculates in which direction to move to follow the path</summary>
publicPathTracerpathTracer;
/// <summary>
/// Local avoidance settings.
///
/// When the agent has local avoidance enabled, these settings will be copied into a <see cref="Pathfinding.ECS.RVO.RVOAgent"/> component which is attached to the agent.
///
/// See: <see cref="enableLocalAvoidance"/>
/// </summary>
[FormerlySerializedAs("rvoAgent")]
publicRVOAgentrvoSettings=RVOAgent.Default;
/// <summary>Callback for when the agent starts to traverse an off-mesh link</summary>
// Right now, the pathTracer is almost fully up to date.
// To make it fully up to date, we'd also have to call pathTracer.UpdateStart and pathTracer.UpdateEnd after this function.
// During normal path recalculations, the JobRepairPath will be scheduled right after this function, and it will
// call those functions. The incomplete state will not be observable outside the system.
// When called from FollowerEntity, the SetPath method on that component will ensure that these methods are called.
}else{
abPath.Release(state);
}
}else{
// Path calculation has been started, but it is not yet complete. Cannot really handle this.
thrownewSystem.ArgumentException("You must call the SetPath method with a path that either has been completely calculated or one whose path calculation has not been started at all. It looks like the path calculation for the path you tried to use has been started, but is not yet finished.");
}
}
publicvoidClearPath(){
pathTracer.Clear();
if(activePath!=null){
activePath.Release(this);
activePath=null;
}
}
publicvoidCancelCurrentPathRequest(){
if(pendingPath!=null){
pendingPath.FailWithError("Canceled by script");
pendingPath.Release(this);
pendingPath=null;
}
}
publicvoidDispose(){
pathTracer.Dispose();
if(pendingPath!=null){
pendingPath.FailWithError("Canceled because entity was destroyed");
pendingPath.Release(this);
pendingPath=null;
}
if(activePath!=null){
activePath.Release(this);
activePath=null;
}
}
/// <summary>
/// Pops the current part, and the next part from the start of the path.
///
/// It is assumed that the agent is currently on a normal NodeSequence part, and that the next part in the path is an off-mesh link.