Skip to main content

Follower

A class in Root.Township, Alta.Pathfinding.

Makes a Navigator keep re-pathing to a moving target on an interval. Made by Director.

Constructors​

MemberWhat it is
Follower(Navigator navigator)Creates a Follower from navigator.

Fields​

6 private and internal fields
MemberWhat it is
private float minimumIntervalShortest time between path requests (interval minus 0.1 seconds).
private Navigator navigatorThe navigator being driven.
private Coroutine reevaluationCoroutineThe running re-path coroutine, if any.
private WaitForSeconds reevaluationIntervalWait between re-paths (default 0.5 seconds).
private ITarget targetThe target being followed.
private float targetReachedDistanceDistance at which the target counts as reached (default 0.1).

Methods​

MemberWhat it is
void Follow(ITarget newTarget, float reevaluationInterval = 0.5, float targetReachedDistance = 0.1)Starts following a target (or updates the interval and reach distance); null stops following.
void StopFollow()Clears the target and stops the re-path loop.
3 private and internal methods
MemberWhat it is
private void ContinueReevaluation(Path path)Seeker path callback that restarts the re-path loop once a pending path request finishes.
private IEnumerator Reevaluation() (iterator)Coroutine that paths to the target's ground position every interval while it is alive, pausing while a path request is pending.
private void StartReevaluationCoroutine()Starts Reevaluation on the navigator.

Used in​

Members of other types that take, return or hold a Follower: