ClassicCityBuilderKit 1.8.8
|
collection of map points or world positions that can be followed by a walker
Classes | |
class | WalkingPathData |
Public Member Functions | |
WalkingPath (Vector2Int[] points) | |
WalkingPath (Vector3[] positions) | |
IEnumerable< Vector2Int > | GetPoints () |
gets all the points in the path in order | |
Vector2Int | GetPoint (int index) |
gets the map point at a specific position | |
IEnumerable< Vector3 > | GetPositions () |
gets all the positions in the path in order | |
Vector3 | GetPosition (int index) |
gets the world position at a specific position | |
Vector3 | GetPosition (int index, float time, float timePerStep) |
interpolates a position between the one at the index and the next one | |
bool | HasEnded (int index) |
checks if the index points to the last element in the path or beyond | |
Vector2Int | GetPreviousPoint (int index) |
returns the starting point of the n-th segment in the path | |
Vector2Int | GetNextPoint (int index) |
returns the ending point of the n-th segment in the path | |
Vector3 | GetPreviousPosition (int index) |
returns the starting position of the n-th segment in the path | |
Vector3 | GetNextPosition (int index) |
returns the ending position of the n-th segment in the path | |
float | GetDistance (int index) |
returns the length of the n-th segment in the path | |
Vector3 | GetDirection (int index) |
returns the direction of the n-th segment in the path | |
float | GetDistance () |
calculates the total length of the path in the world | |
WalkingPath | GetReversed () |
creates a new path going in the opposite direction of this one | |
IEnumerator | Walk (Walker walker, float delay, Action finished, Action< Vector2Int > moved=null) |
initializes the walkers walking state and starts moving the walker along the walking path | |
IEnumerator | ContinueWalk (Walker walker, Action finished, Action< Vector2Int > moved=null) |
when the game is loaded and the walker was previously walking it is continued here | |
IEnumerator | WalkAgent (Walker walker, float delay, Action finished, Action< Vector2Int > moved=null) |
initializes the walkers agent walking state and starts setting destinations for the navmesh agent along the path | |
WalkingPathData | GetData () |
Static Public Member Functions | |
static IEnumerator | WalkAgent (Walker walker, Vector3 destination, float delay, Action finished, Action< Vector2Int > moved=null) |
initializes the walkers agent walking state and starts setting destinations for the navmesh agent along the path | |
static IEnumerator | ContinueWalkAgent (Walker walker, Action finished, Action< Vector2Int > moved=null) |
when the game is loaded and the walker was previously walking it is continued here | |
static IEnumerator | TryWalk (Walker walker, float delay, Func< WalkingPath > pathGetter, Action planned, Action finished, Action canceled=null, Action< Vector2Int > moved=null) |
tries to walk a path that is calculated externaly, if no path is found the walker waits a second and retries until WalkerInfo.MaxWait times it out | |
static IEnumerator | TryWalk (Walker walker, float delay, Func< PathQuery > queryGetter, Action planned, Action finished, Action canceled=null, Action< Vector2Int > moved=null) |
static IEnumerator | TryWalk< T > (Walker walker, float delay, Func< BuildingComponentPathQuery< T > > queryGetter, Action< BuildingComponentPath< T > > planned, Action finished, Action canceled=null, Action< Vector2Int > moved=null) |
static IEnumerator | TryWalk< Q, P > (Walker walker, float delay, Func< Q > preparer, Func< Q, P > planner, Func< P, WalkingPath > planned, Action finished, Action canceled=null, Action< Vector2Int > moved=null) |
static IEnumerator | TryWalk (Walker walker, float delay, IBuilding structure, PathType pathType, object pathTag, Action planned, Action finished, Action canceled=null, Action< Vector2Int > moved=null) |
tries to walk to a structure, if no path is found the walker waits a second and retries until WalkerInfo.MaxWait times it out | |
static IEnumerator | Roam (Walker walker, float delay, Vector2Int start, int memoryLength, int range, PathType pathType, object pathTag, Action finished, Action< Vector2Int > moved=null) |
walker starts walking around semi randomly, visited points are memorized and avoided | |
static IEnumerator | ContinueRoam (Walker walker, int memoryLength, int range, PathType pathType, object pathTag, Action finished, Action< Vector2Int > moved=null) |
continues roaming when the game is loaded and the walker was roaming previously | |
static WalkingPath | FromData (WalkingPathData data) |
|
inlinestatic |
continues roaming when the game is loaded and the walker was roaming previously
walker | the walker to move |
memoryLength | how many points the walker will memorize and try to avoid |
range | how many steps the walker roams before returning |
pathType | which kind of pathfinding will be performed to check which points are available |
pathTag | additional parameter for pathfinding |
finished | called when roaming is finished(regularly or canceled) |
moved | called whenever a new point is reached |
|
inline |
when the game is loaded and the walker was previously walking it is continued here
walker | the walker that will be moved |
finished | called when walking is finished either by reaching the end or cancellation |
moved | called whenever the walker reaches on of the path points |
|
inlinestatic |
when the game is loaded and the walker was previously walking it is continued here
walker | the walker that will be moved |
finished | called when walking is finished either by reaching the end or cancellation |
moved | called whenever the walker reaches on of the path points |
|
inline |
returns the direction of the n-th segment in the path
index | index of the segment(0 is the segment between points 0 and 1) |
|
inline |
calculates the total length of the path in the world
float CityBuilderCore.WalkingPath.GetDistance | ( | int | index | ) |
returns the length of the n-th segment in the path
index | index of the segment(0 is the segment between points 0 and 1) |
|
inline |
returns the ending point of the n-th segment in the path
index | index of the segment(0 is the segment between points 0 and 1) |
|
inline |
returns the ending position of the n-th segment in the path
index | index of the segment(0 is the segment between points 0 and 1) |
|
inline |
gets the map point at a specific position
index | which point to get, starting at 0 |
|
inline |
gets all the points in the path in order
|
inline |
gets the world position at a specific position
index | which position to get, starting at 0 |
Vector3 CityBuilderCore.WalkingPath.GetPosition | ( | int | index, |
float | time, | ||
float | timePerStep ) |
interpolates a position between the one at the index and the next one
index | index of the start point |
time | how long the walker has already walked |
timePerStep | total time the walker needs to walk between the two points |
|
inline |
gets all the positions in the path in order
|
inline |
returns the starting point of the n-th segment in the path
index | index of the segment(0 is the segment between points 0 and 1) |
|
inline |
returns the starting position of the n-th segment in the path
index | index of the segment(0 is the segment between points 0 and 1) |
|
inline |
creates a new path going in the opposite direction of this one
bool CityBuilderCore.WalkingPath.HasEnded | ( | int | index | ) |
checks if the index points to the last element in the path or beyond
index |
|
inlinestatic |
walker starts walking around semi randomly, visited points are memorized and avoided
walker | the walker to move |
delay | duration in seconds the walker waits before starting to roam |
start | the point to start roaming from |
memoryLength | how many points the walker will memorize and try to avoid |
range | how many steps the walker roams before returning |
pathType | which kind of pathfinding will be performed to check which points are available |
pathTag | additional parameter for pathfinding |
finished | called when roaming is finished(regularly or canceled) |
moved | called whenever a new point is reached |
|
inlinestatic |
tries to walk a path that is calculated externaly, if no path is found the walker waits a second and retries until WalkerInfo.MaxWait times it out
walker | the walker that is moved |
delay | duration in seconds the walker will always wait before moving(instead of the default WalkerInfo.Delay) |
pathGetter | function that returns the path the walker should walk or null if no path could be found currently |
planned | called when a path is found |
finished | called when the walker reaches its target |
canceled | called if the walker finds no path and times out or waiting gets canceled |
moved | called whenever the walker reaches on of the path points |
|
inlinestatic |
tries to walk to a structure, if no path is found the walker waits a second and retries until WalkerInfo.MaxWait times it out
walker | the walker that is moved |
delay | duration in seconds the walker will always wait before moving(instead of the default WalkerInfo.Delay) |
start | the point to start from |
structure | the target structure to walk to |
pathType | which kind of pathfinding will be performed to check which points are available |
pathTag | additional parameter for pathfinding |
planned | called when a path is found |
finished | called when the walker reaches its target |
canceled | called if the walker finds no path and times out or waiting gets canceled |
moved | called whenever the walker reaches on of the path points |
|
inlinestatic |
T | : | IBuildingComponent |
|
inline |
initializes the walkers walking state and starts moving the walker along the walking path
walker | the walker that will be moved |
delay | duration to wait before starting to walk in seconds(immediately moving can look abrupt) |
finished | called when walking is finished either by reaching the end or cancellation |
moved | called whenever the walker reaches on of the path points |
IEnumerator CityBuilderCore.WalkingPath.WalkAgent | ( | Walker | walker, |
float | delay, | ||
Action | finished, | ||
Action< Vector2Int > | moved = null ) |
initializes the walkers agent walking state and starts setting destinations for the navmesh agent along the path
walker | the walker that will be moved |
delay | duration to wait before starting to walk in seconds(immediately moving can look abrupt) |
finished | called when walking is finished either by reaching the end or cancellation |
moved | called whenever the walker reaches on of the path points |
|
inlinestatic |
initializes the walkers agent walking state and starts setting destinations for the navmesh agent along the path
walker | the walker that will be moved |
delay | duration to wait before starting to walk in seconds(immediately moving can look abrupt) |
finished | called when walking is finished either by reaching the end or cancellation |
moved | called whenever the walker reaches on of the path points |