Adventure Creator  1.79.1
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2022
AC.Paths Class Reference
Inheritance diagram for AC.Paths:
AC.iActionListAssetReferencer

Public Member Functions

bool WillStopAtNextNode (int currentNode)
 Checks if the next node is the final one. More...
 
void RecalculateToCenter (Vector3 startPosition, float maxNodeDistance=-1f)
 
void BuildNavPath (Vector3[] pointData)
 Rebuilds the nodes List from an array of points. The first point on the new path will be the GameObject's current position. More...
 
int GetNextNode (int currentNode, int prevNode, bool playerControlled=false, AC_PathType lockedPathType=AC_PathType.ForwardOnly)
 Gets the next node along a path, given the current one. More...
 
float GetLengthToNode (int n)
 Gets the distance along the path from the origin to a particular node More...
 
float GetLengthBetweenNodes (int a, int b)
 Gets the distance along the path from one node to another More...
 
float GetTotalLength ()
 Gets the total length of the path More...
 
int GetNearestNode (Vector3 position)
 Gets the index of the node that's nearest to a given position More...
 
bool ReferencesAsset (ActionListAsset actionListAsset)
 
List< ActionListAssetGetReferencedActionListAssets ()
 

Public Attributes

List< Vector3 > nodes = new List<Vector3>()
 
List< NodeCommandnodeCommands = new List<NodeCommand>()
 
ActionListSource commandSource
 
AC_PathType pathType = AC_PathType.ForwardOnly
 
PathSpeed pathSpeed
 
bool teleportToStart
 
bool affectY
 
float nodePause
 

Protected Member Functions

void Awake ()
 
void ConnectNodes (int a, int b)
 
Vector3[] SetMaxDistances (Vector3[] pointArray, float maxNodeDistance)
 

Protected Attributes

bool relativeMode
 
Vector3 lastFramePosition
 

Properties

Vector3 Destination [get]
 
Transform Transform [get]
 
bool RelativeMode [get, set]
 
Vector3 LastFramePosition [get, set]
 

Detailed Description

Stores a series of "nodes", which act as waypoints for character movements. Nodes can either be generated in-game by pathfinding algorithms (see NavigationEngine), or by defining them in the Unity Editor. Characters can be made to move along a path in one direction only, back-and-forth, or choose nodes at random. ActionLists can also be set to run when a character reaches each node.

Member Function Documentation

◆ BuildNavPath()

void AC.Paths.BuildNavPath ( Vector3[]  pointData)

Rebuilds the nodes List from an array of points. The first point on the new path will be the GameObject's current position.

Parameters
pointDataAn array of position vectors that dictate the new path

◆ GetLengthBetweenNodes()

float AC.Paths.GetLengthBetweenNodes ( int  a,
int  b 
)

Gets the distance along the path from one node to another

Parameters
aThe node to start from
bThe node to reach
Returns
The distance along the path between nodes a and b.

◆ GetLengthToNode()

float AC.Paths.GetLengthToNode ( int  n)

Gets the distance along the path from the origin to a particular node

Parameters
nThe index number of the node to check the distance to
Returns
The distance along the path from the origin to node n

◆ GetNearestNode()

int AC.Paths.GetNearestNode ( Vector3  position)

Gets the index of the node that's nearest to a given position

Parameters
positionThe position to query
Returns
The index of the node that's nearest to the position

◆ GetNextNode()

int AC.Paths.GetNextNode ( int  currentNode,
int  prevNode,
bool  playerControlled = false,
AC_PathType  lockedPathType = AC_PathType.ForwardOnly 
)

Gets the next node along a path, given the current one.

Parameters
currentNodeThe index number of the current node
prevNodeThe index number of the previous node (used for determining the direction along which the path is being traversed)
playerControlledTrue if the Player is moving along the path during gameplay
lockedPathTypeThe type of Path, if the Player is moving along it during gameplay
Returns
The index number of the next node

◆ GetTotalLength()

float AC.Paths.GetTotalLength ( )

Gets the total length of the path

Returns
The total length of the path

◆ WillStopAtNextNode()

bool AC.Paths.WillStopAtNextNode ( int  currentNode)

Checks if the next node is the final one.

Parameters
currentNodeThe index number of the current node (i.e. the node before the one being checked)
Returns
True if the next node is the final one

Member Data Documentation

◆ affectY

bool AC.Paths.affectY

If True, then characters will attempt to move vertically to reach nodes

◆ commandSource

ActionListSource AC.Paths.commandSource

The source of ActionList objects that are run when nodes are reached (InScene, AssetFile)

◆ nodeCommands

List<NodeCommand> AC.Paths.nodeCommands = new List<NodeCommand>()

A List of NodeCommand instances that dictate what ActionList is run when each node is reached

◆ nodePause

float AC.Paths.nodePause

The time, in seconds, that a character will wait at each node before continuing along the path

◆ nodes

List<Vector3> AC.Paths.nodes = new List<Vector3>()

A List of nodes (Vector3) that define the path

◆ pathSpeed

PathSpeed AC.Paths.pathSpeed

The speed at which characters will traverse a path (Walk, Run)

◆ pathType

AC_PathType AC.Paths.pathType = AC_PathType.ForwardOnly

The way in which characters move between each node (ForwardOnly, Loop, PingPong, IsRandom)

◆ teleportToStart

bool AC.Paths.teleportToStart

If True, then the character will teleport to the first node before traversing the path

Property Documentation

◆ Destination

Vector3 AC.Paths.Destination
get

Gets the position of the last node in the Path

◆ Transform

Transform AC.Paths.Transform
get

A cache of the Path's transform component