Example AI.
More...
Example AI.
- Deprecated:
- This script has been deprecated, use AIPath, RichAI or MineBotAI instead
|
void | OnDrawGizmos () |
| Draws helper gizmos.
|
|
void | OnPathComplete (Path p) |
| Called when a path has completed it's calculation.
|
|
void | PathToTarget (Vector3 targetPoint) |
| Start a new path moving to targetPoint.
|
|
virtual void | ReachedEndOfPath () |
| Called when the AI reached the end of path.
|
|
virtual void | Repath () |
| Recalculates the path to target.
|
|
void | Reset () |
| Will make the AI give up it's current path and stop completely.
|
|
void | Resume () |
| Resumes walking and path searching the AI.
|
|
void | Start () |
| Use this for initialization.
|
|
void | Stop () |
| Stops the AI.
|
|
void | Update () |
| Update is called once per frame.
|
|
IEnumerator | WaitToRepath () |
| Waits the remaining time until the AI should issue a new path request.
|
|
|
CharacterController | controller |
| CharacterController which handles movement.
|
|
float | lastPathSearch = -9999 |
|
Vector3[] | path |
| This is the path the AI is currently following.
|
|
int | pathIndex = 0 |
|
Seeker | seeker |
| Seeker component which handles pathfinding calls.
|
|
Transform | tr |
| Transform, cached because of performance.
|
|
Draws helper gizmos.
Currently draws a circle around the current target point with the size showing how close the AI need to get to it for it to count as "reached".
void OnPathComplete |
( |
Path |
p | ) |
|
Called when a path has completed it's calculation.
void PathToTarget |
( |
Vector3 |
targetPoint | ) |
|
Start a new path moving to targetPoint.
virtual void ReachedEndOfPath |
( |
| ) |
|
|
virtual |
Called when the AI reached the end of path.
This will be called once for every path it completes, so if you have a really fast repath rate it will call this function often if when it stands on the end point.
Recalculates the path to target.
Queries a path request to the Seeker, the path will not be calculated instantly, but will be put on a queue and calculated as fast as possible. It will wait if the current path request by this seeker has not been completed yet.
- See Also
- Seeker.IsDone
Will make the AI give up it's current path and stop completely.
Use this for initialization.
Stops the AI.
Also stops new search queries from being made
- Since
- Before 3.0.8 This does not prevent new path calls from making the AI move again
- See Also
- Resume
-
canMove
-
canSearch
Update is called once per frame.
IEnumerator WaitToRepath |
( |
| ) |
|
Waits the remaining time until the AI should issue a new path request.
The remaining time is defined by Time.time - lastPathSearch
Can it move.
Enables or disables movement and rotation
Should paths be searched for.
Setting this to false will make the AI not search for paths anymore, can save some CPU cycles. It will check every repathRate seconds if it should start to search for paths again.
- Note
- It will not cancel paths which are currently being calculated
CharacterController controller |
|
protected |
CharacterController which handles movement.
float lastPathSearch = -9999 |
|
protected |
This is the path the AI is currently following.
float pickNextWaypointDistance = 1F |
The minimum distance to a waypoint to consider it as "reached".
How often to search for a new path.
How fast the AI can turn around.
Seeker component which handles pathfinding calls.
float targetReached = 0.2F |
Transform, cached because of performance.
The documentation for this class was generated from the following file:
- /Users/arong/Unity/a-pathfinding-project/Assets/AstarPathfindingProject/ExampleScenes/ExampleScripts/AIFollow.cs