Loading...
Searching...
No Matches
CityBuilderCore.ProcessState Class Reference

Detailed Description

helper class for Walker that holds the current status of a running process
a process is a series of WalkerActions that is usually started from within the walker
ProcessState takes care of tracking the currently active action as well as advancing to the next one or canceling the process
Walker.StartProcess(WalkerAction[], string) starts a new process, when a walker is loaded use Walker.continueProcess
a process can be canceled by Walker.CancelProcess which may not end the process immediately but rather when the walker is in an ok state next

Classes

class  ProcessData
 

Public Member Functions

 ProcessState (string key, WalkerAction[] actions)
 
void Start (Walker walker)
 starts the process and, in extension, the first action in it
 
bool Advance (Walker walker)
 moves the process to the next action or finishes it when the last one has been finished
 
void Continue (Walker walker)
 called when a game is loaded so the process can continue where it left off
 
void Cancel (Walker walker)
 requests for the process to be canceled, the process may not finish immediately but rather when it next is in a good state
 
ProcessData GetData ()
 

Static Public Member Functions

static ProcessState FromData (ProcessData data)
 

Properties

string Key [get]
 identifier that can be used to check what the walker is currently doing
 
WalkerAction[] Actions [get]
 actions that are executed in order
 
int CurrentIndex [get]
 index of the currently active action
 
bool IsCanceled [get]
 whether the process has been canceled, useful to check if a task has actually been performed or just distruped by something else
 
WalkerAction CurrentAction [get]
 currently active action
 

Member Function Documentation

◆ Advance()

bool CityBuilderCore.ProcessState.Advance ( Walker walker)
inline

moves the process to the next action or finishes it when the last one has been finished

Parameters
walkerthe walker the process is performed on
Returns
true if the next action has been started successfully, false if the process is finished or canceled

◆ Cancel()

void CityBuilderCore.ProcessState.Cancel ( Walker walker)
inline

requests for the process to be canceled, the process may not finish immediately but rather when it next is in a good state

Parameters
walkerthe walker the process is performed on

◆ Continue()

void CityBuilderCore.ProcessState.Continue ( Walker walker)
inline

called when a game is loaded so the process can continue where it left off

Parameters
walkerthe walker the process is performed on

◆ Start()

void CityBuilderCore.ProcessState.Start ( Walker walker)
inline

starts the process and, in extension, the first action in it

Parameters
walkerthe walker the process is performed on