Polarith AI
1.8
AIMUnityPathfinding Class Reference

Description

As a concrete implementation of AIMPathfinding, this class is used for calculating a path based on Unity's NavMesh.

Actually, it takes advantage of NavMeshAgent for an asynchronous pathfinding computation. For that, we disabled the controller mechanism from the agent by setting NavMeshAgent.updatePosition to false.

Inheritance diagram for AIMUnityPathfinding:
AIMPathfinding AIMPathConnector

Public Fields

Action< GameObject, OffMeshLinkData > OffMeshLinkReached
 This delegate is called once whenever the agent is on an OffMeshLink. More...
 
Action PathChanged
 Processed if the path was modified or not. More...
 

Protected Fields

Vector3 destination = new Vector3()
 Destination of the current path. More...
 
GameObject destinationGameObject
 This game object determines the destination of the path to be calculated. More...
 
List< Validatorvalidators = new List<Validator>()
 These list determines the validators to be used in order to verify the path by calling Validator.Validate. More...
 
DistanceValidator distanceValidator = new DistanceValidator()
 Verifies the distance between the agent and the path. More...
 
TargetValidator targetValidator = new TargetValidator()
 Verifies if the target has moved. More...
 
TimeValidator timeValidator = new TimeValidator()
 Verifies if a set time has elapsed. More...
 
Color firstColor = Color.magenta
 Determines the color of all vertices as well as the start color of the edges. More...
 
Color secondColor = Color.cyan
 Determines the end color of the edges as well as the color of the path destination. More...
 
float scale = 1.0f
 Resizes the visualized sphere for each path point. More...
 
bool enableVisualization = true
 Specifies if path points are to be visualized or not. More...
 

Properties

NavMeshAgentValidator NavMeshAgentValidator [get]
 This validator verifies the current path status (read only). More...
 
NavMeshAgent NavMeshAgent [get]
 The current NavMeshAgent used for the pathfinding (read only). More...
 
bool PathInProgress [get]
 If true, the computation of a new path is currently in progress, false otherwise (read only). More...
 
override IList< Vector3 > points [get]
 Returns the path points in global coordinates as a copy. More...
 
Vector3 Destination [get, set]
 Gets or sets a new destination whereby a re-computation of the path starts. More...
 
GameObject DestinationGameObject [get, set]
 Sets a new target game object whereby a re-computation of the path starts. More...
 
DistanceValidator DistanceValidator [get]
 Verifies the distance between the agent and the path (read only). More...
 
TargetValidator TargetValidator [get]
 Verifies if the target has moved (read only). More...
 
TimeValidator TimeValidator [get]
 Verifies if a set time has elapsed (read only). More...
 

Public Methods

override void CalculatePath (Vector3 destination)
 Starts the computation of a path by using NavMeshAgent.destination. More...
 
virtual IList< Vector3 > GetPoints ()
 Returns the points in global coordinates, whereby it allocates memory and copies the original data. More...
 
virtual void GetPointsNonAlloc (IList< Vector3 > points)
 Returns the points in global coordinates without allocating memory. More...
 
virtual IList< Vector3 > GetLocalPoints ()
 Returns the points in local coordinates, whereby it allocates memory and copies the original data. More...
 
virtual void GetLocalPointsNonAlloc (IList< Vector3 > points)
 Returns the points in local coordinates without allocating memory. More...
 

Protected Methods

override void UpdateValidators ()
 Transfers the internally used validator data. More...
 
override void Start ()
 Sets up AIMPathfinding.validators. More...
 
override void Update ()
 This methods fulfills three purposes. More...
 
virtual void OnDrawGizmos ()
 Provides a basic visualization of the given points of this path. More...
 
virtual void DrawPoint (int index)
 Visualizes a specific path point by using Gizmos.DrawSphere(Vector3, float). More...
 
virtual void DrawEdge (int startPointIndex)
 Visualizes a specific edge drawing a fancy gradient. More...
 
Imprint