JUtils
A unity utilities library
|
A mono behaviour state-machine that can also be used as a state More...
Classes | |
struct | QueueEntry |
Representation of the state and its data in the queue More... | |
Public Member Functions | |
void | GoToState ([NotNull] State state, [CanBeNull] StateData data) |
Queues the current given state, then goes to it More... | |
void | GoToState< T > ([CanBeNull] StateData data) |
Clears the StateQueue and goes to the given state More... | |
void | AddToQueue ([NotNull] State state, [CanBeNull] StateData data, bool queueFirst=false) |
Adds a new state to the queue More... | |
void | AddToQueue< T > ([CanBeNull] StateData data, bool queueFirst=false) |
Adds a new state to the queue More... | |
void | ClearQueue () |
Clears all states in the queue More... | |
void | ContinueQueue () |
Deactivate the current state and go to the next one More... | |
T | FindState< T > () |
Find a state within the child objects of this state-machine, if _autoCreateStates is enabled, it will automatically instantiate the state More... | |
bool | TryFindState< T > (out T state) |
Try finding a state within the child objects of this state-machine, if _autoCreateStates is enabled, it will automatically instantiate that state More... | |
void | Activate ([CanBeNull] StateData data=null) |
Activates the state machine More... | |
new void | Deactivate () |
Continues the queue in the state machine, or deactivates the state if it is the root state machine More... | |
void | GoToState (State state) |
Clears the StateQueue and goes to the given state More... | |
void | GoToState< T, T1 > (T state, T1 arg1) |
Clears the StateQueue and goes to the given state More... | |
void | GoToState< T, T1, T2 > (T state, T1 arg1, T2 arg2) |
Clears the StateQueue and goes to the given state More... | |
void | GoToState< T, T1, T2, T3 > (T state, T1 arg1, T2 arg2, T3 arg3) |
Clears the StateQueue and goes to the given state More... | |
void | GoToState< T > () |
Adds a new state to the queue More... | |
void | GoToState< T, T1 > (T1 arg1) |
Clears the StateQueue and goes to the given state More... | |
void | GoToState< T, T1, T2 > (T1 arg1, T2 arg2) |
Clears the StateQueue and goes to the given state More... | |
void | GoToState< T, T1, T2, T3 > (T1 arg1, T2 arg2, T3 arg3) |
Clears the StateQueue and goes to the given state More... | |
void | GoToState< T, T1, T2, T3 > (StateRef< T > stateRef, T1 arg1, T2 arg2, T3 arg3) |
Adds a new state to the queue More... | |
void | GoToState< T, T1, T2 > (StateRef< T > stateRef, T1 arg1, T2 arg2) |
Adds a new state to the queue More... | |
void | GoToState< T, T1 > (StateRef< T > stateRef, T1 arg1) |
Adds a new state to the queue More... | |
void | GoToState< T > (StateRef< T > stateRef) |
Adds a new state to the queue More... | |
void | AddToQueue< T > (T state, bool queueFist=false) |
Adds a new state to the queue More... | |
void | AddToQueue< T, T1 > (T state, T1 arg1, bool queueFist=false) |
Adds a new state to the queue More... | |
void | AddToQueue< T, T1, T2 > (T state, T1 arg1, T2 arg2, bool queueFist=false) |
Adds a new state to the queue More... | |
void | AddToQueue< T, T1, T2, T3 > (T state, T1 arg1, T2 arg2, T3 arg3, bool queueFirst=false) |
Adds a new state to the queue More... | |
void | AddToQueue< T > (bool queueFist=false) |
Adds a new state to the queue More... | |
void | AddToQueue< T, T1 > (T1 arg1, bool queueFirst=false) |
Adds a new state to the queue More... | |
void | AddToQueue< T, T1, T2 > (T1 arg1, T2 arg2, bool queueFirst=false) |
Adds a new state to the queue More... | |
void | AddToQueue< T, T1, T2, T3 > (T1 arg1, T2 arg2, T3 arg3, bool queueFirst=false) |
Adds a new state to the queue More... | |
void | AddToQueue< T, T1, T2, T3 > (StateRef< T > stateRef, T1 arg1, T2 arg2, T3 arg3, bool queueFirst=false) |
Adds a new state to the queue More... | |
void | AddToQueue< T, T1, T2 > (StateRef< T > stateRef, T1 arg1, T2 arg2, bool queueFirst=false) |
Adds a new state to the queue More... | |
void | AddToQueue< T, T1 > (StateRef< T > stateRef, T1 arg1, bool queueFirst=false) |
Adds a new state to the queue More... | |
void | AddToQueue< T > (StateRef< T > stateRef, bool queueFirst=false) |
Adds a new state to the queue More... | |
Protected Member Functions | |
abstract void | OnNoState () |
Gets called when there is no next state in the queue More... | |
override void | Awake () |
virtual void | Start () |
virtual void | Reset () |
virtual void | OnValidate () |
Protected Member Functions inherited from JUtils.State< T1, T2, T3 > | |
void | Deactivate () |
Deactivate this state and make the state-machine continue its queue More... | |
abstract void | OnActivate () |
Gets called when the state activates More... | |
abstract void | OnDeactivate () |
Gets called when the sate deactivates More... | |
StateRef< T > | Ref< T > () |
Used for making typed argument adding to states prettier More... | |
virtual void | ActiveUpdate () |
Only runs the Update() function when the state is active More... | |
virtual void | Update () |
override void | OnActivate () |
abstract void | OnActivate (T param) |
override void | OnActivate () |
abstract void | OnActivate (T1 param1, T2 param2) |
override void | OnActivate () |
abstract void | OnActivate (T1 param1, T2 param2, T3 param3) |
Protected Attributes | |
State | currentState |
List< QueueEntry > | stateQueue = new() |
Properties | |
bool | hasActiveState [get] |
bool | isQueueFilled [get] |
bool | isQueueEmpty [get] |
new StateMachine | stateMachine [get] |
Properties inherited from JUtils.State< T1, T2, T3 > | |
bool | isActive [get] |
bool | isActivating [get] |
Is set to true while the state is activating More... | |
bool | isDeactivating [get] |
Is set to true while the state is deactivating More... | |
StateMachine | stateMachine [get, set] |
The reference of this state's state machine More... | |
float | timeInState [get] |
Get the amount of seconds that this state is active. Returns 0 if the state is not active More... | |
float | unscaledTimeInState [get] |
Get the amount of unscaled seconds that this state is active. Returns 0 if the state is not active More... | |
StateData | stateData [get] |
Events | |
Action< State > | onStateChanged |
Events inherited from JUtils.State< T1, T2, T3 > | |
Action< State > | onStateActivate |
Action< State > | onStateDeactivate |
A mono behaviour state-machine that can also be used as a state
|
inline |
Activates the state machine
References JUtils.State< T1, T2, T3 >.isActive.
|
inline |
Adds a new state to the queue
|
inline |
Adds a new state to the queue
T | : | State |
References JUtils.StateMachine.AddToQueue().
|
inline |
Adds a new state to the queue
T | : | State |
References JUtils.StateMachine.AddToQueue< T >().
|
inline |
Adds a new state to the queue
T | : | State |
References JUtils.StateMachine.AddToQueue< T >().
|
inline |
Adds a new state to the queue
T | : | State |
References JUtils.StateMachine.AddToQueue().
|
inline |
Adds a new state to the queue
T | : | State<T1> |
References JUtils.StateMachine.AddToQueue< T >().
|
inline |
Adds a new state to the queue
T | : | State<T1> |
References JUtils.StateMachine.AddToQueue().
|
inline |
Adds a new state to the queue
T | : | State<T1> |
References JUtils.StateMachine.AddToQueue< T >().
|
inline |
Adds a new state to the queue
T | : | State | |
T | : | T1 | |
T | : | T2 |
References JUtils.StateMachine.AddToQueue< T >().
|
inline |
Adds a new state to the queue
T | : | State | |
T | : | T1 | |
T | : | T2 |
References JUtils.StateMachine.AddToQueue().
|
inline |
Adds a new state to the queue
T | : | State | |
T | : | T1 | |
T | : | T2 |
References JUtils.StateMachine.AddToQueue< T >().
|
inline |
Adds a new state to the queue
T | : | State | |
T | : | T1 | |
T | : | T2 | |
T | : | T3 |
References JUtils.StateMachine.AddToQueue< T >().
|
inline |
Adds a new state to the queue
T | : | State | |
T | : | T1 | |
T | : | T2 | |
T | : | T3 |
References JUtils.StateMachine.AddToQueue().
|
inline |
Adds a new state to the queue
T | : | State | |
T | : | T1 | |
T | : | T2 | |
T | : | T3 |
References JUtils.StateMachine.AddToQueue< T >().
|
inlineprotectedvirtual |
Reimplemented from JUtils.State< T1, T2, T3 >.
|
inline |
Clears all states in the queue
References JUtils.StateMachine.stateQueue.
|
inline |
Deactivate the current state and go to the next one
References JUtils.StateMachine.currentState, JUtils.StateMachine.QueueEntry.data, JUtils.State< T1, T2, T3 >.isActive, JUtils.StateMachine.isQueueFilled, JUtils.StateMachine.OnNoState(), JUtils.StateMachine.onStateChanged, JUtils.StateMachine.QueueEntry.state, JUtils.State< T1, T2, T3 >.stateMachine, and JUtils.StateMachine.stateQueue.
|
inline |
Continues the queue in the state machine, or deactivates the state if it is the root state machine
References JUtils.State< T1, T2, T3 >.isActive, and JUtils.StateMachine.stateMachine.
|
inline |
Find a state within the child objects of this state-machine, if _autoCreateStates is enabled, it will automatically instantiate the state
T | : | State |
Queues the current given state, then goes to it
References JUtils.StateMachine.ContinueQueue().
|
inline |
Clears the StateQueue and goes to the given state
References JUtils.StateMachine.GoToState().
|
inline |
Adds a new state to the queue
T | : | State |
|
inline |
Clears the StateQueue and goes to the given state
T | : | State |
References JUtils.StateMachine.GoToState().
|
inline |
Adds a new state to the queue
T | : | State |
References JUtils.StateMachine.GoToState< T >().
|
inline |
Adds a new state to the queue
T | : | State<T1> |
References JUtils.StateMachine.GoToState< T >().
|
inline |
Clears the StateQueue and goes to the given state
T | : | State<T1> |
References JUtils.StateMachine.GoToState().
|
inline |
Clears the StateQueue and goes to the given state
T | : | State<T1> |
References JUtils.StateMachine.GoToState< T >().
|
inline |
Adds a new state to the queue
T | : | State | |
T | : | T1 | |
T | : | T2 |
References JUtils.StateMachine.GoToState< T >().
|
inline |
Clears the StateQueue and goes to the given state
T | : | State | |
T | : | T1 | |
T | : | T2 |
References JUtils.StateMachine.GoToState().
|
inline |
Clears the StateQueue and goes to the given state
T | : | State | |
T | : | T1 | |
T | : | T2 |
References JUtils.StateMachine.GoToState< T >().
|
inline |
Adds a new state to the queue
T | : | State | |
T | : | T1 | |
T | : | T2 | |
T | : | T3 |
References JUtils.StateMachine.GoToState< T >().
|
inline |
Clears the StateQueue and goes to the given state
T | : | State | |
T | : | T1 | |
T | : | T2 | |
T | : | T3 |
References JUtils.StateMachine.GoToState().
|
inline |
Clears the StateQueue and goes to the given state
T | : | State | |
T | : | T1 | |
T | : | T2 | |
T | : | T3 |
References JUtils.StateMachine.GoToState< T >().
|
protectedpure virtual |
Gets called when there is no next state in the queue
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
References JUtils.State< T1, T2, T3 >.isActive.
|
inline |
Try finding a state within the child objects of this state-machine, if _autoCreateStates is enabled, it will automatically instantiate that state
T | : | State |
|
protected |
|
protected |
|
get |
|
get |
|
get |
|
get |
Action<State> JUtils.StateMachine.onStateChanged |