ClassicCityBuilderKit 1.8.8
|
Public Member Functions | |
override void | Initialize (BuildingReference home, Vector2Int start) |
called right after instantiating or reactivating a walker buildings have not had a chance to interact with the walker when your logic needs something from outside first override Spawned instead | |
Public Member Functions inherited from CityBuilderCore.Walker | |
virtual void | Spawned () |
called after the walker is fully initialized and its spawning has been signaled to the owner | |
void | StartProcess (WalkerAction[] actions, string key=null) |
starts a series of WalkerActions as a process the actions will be executed in order until the end is reached if another process is already running it is cancelled | |
void | AdvanceProcess () |
mvoes the process to the next action or finishes it when the last action is finished | |
void | CancelProcess () |
requests for the current process to be cancelled | |
void | roam (int memoryLength, int range, PathType pathType, UnityEngine.Object pathTag, Action finished=null) |
walker starts walking around semi randomly, visited points are memorized and avoided | |
void | roam (int memoryLength, int range, Action finished=null) |
walker starts walking around semi randomly, visited points are memorized and avoided | |
void | roam (float delay, int memoryLength, int range, Action finished=null) |
walker starts walking around semi randomly after waiting for a set duration, visited points are memorized and avoided | |
void | continueRoam (int memoryLength, int range, Action finished) |
continues roaming when the game is loaded and the walker was roaming previously uses the default pathing defined in the walkers inspector to get points | |
void | continueRoam (int memoryLength, int range, PathType pathType, UnityEngine.Object pathTag, Action finished) |
continues roaming when the game is loaded and the walker was roaming previously uses the pathing passed in the parameters to get points | |
void | cancelRoam () |
requests for the current roaming to be stopped, will not happen immediately but when the next point is reached | |
bool | walk (IBuilding target, Action finished=null) |
tries to walk to a building using default pathing defined in the inspector | |
bool | walk (Vector2Int target, Action finished=null) |
tries to walk to a specific point using default pathing defined in the inspector | |
bool | walk (Vector2Int target, PathType pathType, UnityEngine.Object pathTag, Action finished=null) |
tries to walk to a specific point using the pathing passed in the parameters | |
void | walk (WalkingPath path, Action finished=null) |
starts walking a set walking path | |
void | walk (WalkingPath path, float delay, Action finished=null) |
starts walking a set walking path | |
void | continueWalk (Action finished=null) |
when the game is loaded and the walker was previously walking it is continued here | |
void | cancelWalk () |
stops the current walking, walking may not stop immediately but rather when the walker reaches the next full point | |
void | wander (Action finished) |
starts walking to a random neighbouring point if one is available | |
void | continueWander (Action finished) |
when the game is loaded and the walker was previously wandering it is continued here | |
void | wait (Action finished, float time) |
starts waiting for a set duration | |
void | delay (Action finished) |
waits for the duration configured in WalkerInfo.Delay | |
void | continueWait (Action finished) |
when the game is loaded and the walker was previously waiting it is continued here | |
void | cancelWait () |
cancels waiting, remaining time is set to 0 and finished is called | |
void | Hide () |
hides the walker by deactivating its pivot and disableing its collider | |
void | Show () |
hides the walker by activating its pivot and enableing its collider | |
void | Finish () |
Removes the walker from the map(when it has done its job or died for example) | |
virtual string | GetName () |
virtual string | GetDescription () |
gets displayed in dialogs to show the walker description to players | |
virtual string | GetDebugText () |
returns text that gets displayed for debugging in the scene editor | |
T | AddAddon< T > (T prefab) |
adds and initializes an addon onto the walker from a prefab | |
T | GetAddon< T > (T _) |
get the first addon of the specified type | |
T | GetAddon< T > (string key) |
get the first addon with the specified key | |
bool | HasAddon< T > () |
checks if a certain addon type is present on the walker | |
bool | HasAddon< T > (T _) |
checks if a certain addon type is present on the walker | |
bool | HasAddon (string key) |
checks if an addon with a specific key is present on the walker | |
void | RemoveAddon (WalkerAddon addon) |
terminates and removes an addon from the walker | |
bool | RemoveAddon (string key) |
terminates and removes an addon from the building with the given key or returns false if none were found | |
virtual string | SaveData () |
serializes the objects state(usually to json) and returns it | |
virtual void | LoadData (string json) |
deserializes the serialized json data and loads the data as its new state | |
Public Attributes | |
Transform | Target |
bool | ShouldArrive |
Public Attributes inherited from CityBuilderCore.Walker | |
WalkerInfo | Info |
Transform | Pivot |
Animator | Animator |
NavMeshAgent | Agent |
BoolEvent | IsWalkingChanged |
Vector3Event | DirectionChanged |
Protected Member Functions | |
override void | Start () |
override void | onProcessFinished (ProcessState process) |
called when the current process is finished, may be overridden to look for something else to do(for example in the town demo) | |
Protected Member Functions inherited from CityBuilderCore.Walker | |
virtual void | OnDestroy () |
virtual void | onMoved (Vector2Int point) |
called whenever movement reaches a point in its path these are corner points in regular movement and every path point when roaming | |
virtual void | onFinished () |
called to remove the walker from the map when it has done its job(or died) | |
void | followPath (IEnumerable< Vector3 > path, Action finished) |
starts walking a set series of points | |
void | followPath (IEnumerable< Vector3 > path, float delay, Action finished) |
starts walking a set walking path | |
void | continueFollow (Action finished) |
continues following a path when a game is loaded and the walker was previously doing so | |
void | tryWalk (IBuilding target, float delay, Action planned=null, Action finished=null, Action canceled=null) |
tries to walk to a building, if no path is found the walker waits a second and retries until WalkerInfo.MaxWait times it out | |
void | tryWalk (Vector2Int target, float delay, Action planned=null, Action finished=null, Action canceled=null) |
tries to walk to a point, if no path is found the walker waits a second and retries until WalkerInfo.MaxWait times it out | |
void | tryWalk (Func< WalkingPath > pathGetter, float delay, Action planned=null, Action finished=null, Action canceled=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 | |
void | tryWalk (IBuilding target, Action planned=null, Action finished=null, Action canceled=null) |
tries to walk to a building, if no path is found the walker waits a second and retries until WalkerInfo.MaxWait times it out | |
void | tryWalk (Vector2Int target, Action planned=null, Action finished=null, Action canceled=null) |
tries to walk to a point, if no path is found the walker waits a second and retries until WalkerInfo.MaxWait times it out | |
void | tryWalk (Func< WalkingPath > pathGetter, Action planned=null, Action finished=null, Action canceled=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 | |
void | tryWalk (Func< PathQuery > queryGetter, Action planned=null, Action finished=null, Action canceled=null) |
tries to walk a path that is calculated externaly using a query, if no path is found the walker waits a second and retries until WalkerInfo.MaxWait times it out | |
void | tryWalk (Func< PathQuery > queryGetter, float delay, Action planned=null, Action finished=null, Action canceled=null) |
tries to walk a path that is calculated externaly using a query, if no path is found the walker waits a second and retries until WalkerInfo.MaxWait times it out | |
void | tryWalk< T > (Func< BuildingComponentPathQuery< T > > queryGetter, Action< BuildingComponentPath< T > > planned=null, Action finished=null, Action canceled=null) |
tries to walk a path to a component that is calculated externaly using a query, if no path is found the walker waits a second and retries until WalkerInfo.MaxWait times it out | |
void | tryWalk< T > (Func< BuildingComponentPathQuery< T > > queryGetter, float delay, Action< BuildingComponentPath< T > > planned=null, Action finished=null, Action canceled=null) |
tries to walk a path to a component that is calculated externaly using a query, if no path is found the walker waits a second and retries until WalkerInfo.MaxWait times it out | |
void | tryWalk< Q, P > (Func< Q > preparer, Func< Q, P > planner, Func< P, WalkingPath > planned, Action finished=null, Action canceled=null) |
tries to walk a path that created in a two step process, if no path is found the walker waits a second and retries until WalkerInfo.MaxWait times it out | |
void | tryWalk< Q, P > (Func< Q > preparer, Func< Q, P > planner, Func< P, WalkingPath > planned, float delay, Action finished=null, Action canceled=null) |
tries to walk a path that created in a two step process, if no path is found the walker waits a second and retries until WalkerInfo.MaxWait times it out | |
string | getDescription (int index) |
returns a specific description that may explain the current walker status | |
string | getDescription (int index, params object[] parameters) |
returns a specific description that may explain the current walker status with placeholders replaced by specified parameters for example 'delivering {1} to {2} from {0}' where 0 is the home building name, 1 is the item name and 2 is the target building(DeliveryWalker in ThreeDemo) | |
WalkerData | savewalkerData () |
void | loadWalkerData (WalkerData data) |
Properties | |
bool | HasFinished [get] |
bool | HasArrived [get] |
Properties inherited from CityBuilderCore.Walker | |
Guid | Id = Guid.NewGuid() [get, set] |
unique walker identifier that is also persisted, can be used to save references to walkers | |
BuildingReference | Home [get, set] |
reference to the building the walker was spawned from, if any | |
ProcessState | CurrentProcess [get, set] |
returns the current ProcessState if a process is currently active | |
ProcessState | NextProcess [get, set] |
the process that will be started when the current one finishes is used when a process is started when another one is still running | |
RoamingState | CurrentRoaming [get, set] |
returns the current RoamingState if the walker is currently roaming | |
WalkingState | CurrentWalking [get, set] |
returns the current WalkingState if the walker is currently walking | |
WalkingAgentState | CurrentAgentWalking [get, set] |
returns the current WalkingState if the walker is currently walking using a navmesh agent | |
WaitingState | CurrentWaiting [get, set] |
returns the current WaitingState if the walker is currently waiting | |
float? | HeightOverride [get, set] |
height that the entity is forced to have, null to use the regular height(terrain or road height) | |
Vector2Int | CurrentPoint [get] |
last map point the walker has finished moving to, used whenever a new path needs to be found or just to check where the walker is | |
Vector2Int | GridPoint [get] |
map point the walker is currently positioned on by absolute position | |
virtual float | Speed [get] |
virtual PathType | PathType [get] |
virtual UnityEngine.Object | PathTag [get] |
optional parameter for pathfinding, depends on PathType for example a road for road pathing to only walk on that specific road | |
virtual ItemStorage | ItemStorage [get] |
item storage of the walker if there is one | |
WalkerAction | CurrentAction [get] |
currently active action when a process is running | |
bool | IsWalking [get, set] |
whether the walker is currently moving(roaming, walking or agent walking) | |
IReadOnlyCollection< WalkerAddon > | Addons [get] |
currently active WalkerAddons on this walker | |
Properties inherited from CityBuilderCore.IOverrideHeight |
Additional Inherited Members | |
Protected Attributes inherited from CityBuilderCore.Walker | |
List< WalkerAddon > | _addonsQueue = new List<WalkerAddon>() |
addons that are queued up when an addon uses BuildingAddon.AddonAccumulationMode.Queue in this case every addon after the first is put into the queue and when an addon is removed the queue is empties first | |
List< WalkerAddon > | _addons = new List<WalkerAddon>() |
currently active WalkerAddons on this walker | |
Vector2Int | _start |
map point the walker was initialized on, used in roamers to return back to | |
Vector2Int | _current |
last map point the walker has finished moving to, used whenever a new path needs to be found or just to check where the walker is | |
bool | _isFinished |
whether the walker has finished and is no longer active on the map, can be used to make sure a walker does not perform any further actions once finished | |
Events inherited from CityBuilderCore.Walker | |
Action< Walker > | Finished |
fired when the walker is finished, used by spawners to destroy/deactivate the walker | |
Action< Walker > | Moved |
fired whenever the walker has moved to a 'corner' in its path, for every point when roaming | |
|
inlinevirtual |
called right after instantiating or reactivating a walker
buildings have not had a chance to interact with the walker
when your logic needs something from outside first override Spawned instead
home | |
start |
Reimplemented from CityBuilderCore.Walker.
|
inlineprotectedvirtual |
called when the current process is finished, may be overridden to look for something else to do(for example in the town demo)
process |
Reimplemented from CityBuilderCore.Walker.
|
inlineprotectedvirtual |
Reimplemented from CityBuilderCore.Walker.