Skip to main content

Director

A class in Root.Township, Alta.Pathfinding.

The high level movement control for a creature: walk to a point, follow a target, wander or teleport. Drives the Navigator in its parents.

Constructors​

MemberWhat it is
Director()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

4 private and internal fields
MemberWhat it is
private Follower followerPrivate: handles Follow, re-pathing to a moving target.
private Navigator navigatorBacking field for Navigator.
private float reevaluationIntervalSeconds between path updates while following a target. Defaults to 0.5.
private Rigidbody topicThe rigidbody moved by TeleportTo.

Properties​

MemberWhat it is
Navigator Navigator { get; }The navigator that finds and walks paths.
Vector3? TargetFacing { get; set; }A direction the creature should face when it arrives, or null.

Methods​

MemberWhat it is
void Follow(ITarget target, float targetReachedDistance)Keeps walking toward a moving target, rechecking the path every half second by default.
void Follow(ITarget target)Keeps walking toward a moving target, rechecking the path every half second by default.
void Stop()Stops following and navigating.
void TeleportTo(Transform target)Moves the creature's Rigidbody to a valid spot near the position, optionally snapping to the ground height.
void TeleportTo(Vector3 position)Moves the creature's Rigidbody to a valid spot near the position, optionally snapping to the ground height.
void TeleportTo(Vector3 position, bool isSnappingY)Moves the creature's Rigidbody to a valid spot near the position, optionally snapping to the ground height.
void WalkTo(Transform target, float targetReachedDistance)Stops following and walks to a point or a transform's current position, optionally within a reach distance.
void WalkTo(Transform target)Stops following and walks to a point or a transform's current position, optionally within a reach distance.
void WalkTo(Vector3 position, float targetReachedDistance)Stops following and walks to a point or a transform's current position, optionally within a reach distance.
void WalkTo(Vector3 position)Stops following and walks to a point or a transform's current position, optionally within a reach distance.
void Wander(Vector3 near, int searchLength, Vector3 idealDirection, int bestOf = 1)Stops following and walks to a random nearby spot, optionally near a point and toward a direction.
void Wander(Vector3 near, int searchLength)Stops following and walks to a random nearby spot, optionally near a point and toward a direction.
void Wander(int searchLength)Stops following and walks to a random nearby spot, optionally near a point and toward a direction.
2 private and internal methods
MemberWhat it is
private void Awake()Finds the Navigator in the parents and makes a Follower for it.
private void OnDestroy()Private: stops all movement.

Used in​

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