Night Sky Engine
A fighting game framework made in Unreal Engine
|
The player object's state machine. More...
#include <StateMachine.h>
Public Member Functions | |
void | AddState (const FGameplayTag &Name, UState *Config) |
FORCEINLINE bool | IsCurrentState (const FGameplayTag &Name) const |
FGameplayTag | GetStateName (int Index) |
int | GetStateIndex (FGameplayTag Name) const |
bool | SetState (const FGameplayTag Name, bool bIsAlias=false) |
bool | ForceSetState (const FGameplayTag Name, bool bIsAlias=false) |
bool | ForceSetState (TSubclassOf< UState > Class, bool bIsAlias=false) |
bool | ForceRollbackState (const FGameplayTag Name) |
void | Update () const |
Static Public Member Functions | |
static bool | CheckStateStanceCondition (const EEntryStance StateStance, const int PlayerStance) |
Public Attributes | |
UState * | CurrentState |
TArray< UState * > | States |
TArray< FGameplayTag > | StateNames |
APlayerObject * | Parent |
The player object's state machine.
Contains all player states and state names, as well as the currently active state.
Definition at line 15 of file StateMachine.h.
void FStateMachine::AddState | ( | const FGameplayTag & | Name, |
UState * | Config ) |
Adds a state to the state machine. If no current state is set, the input state will be used as the current state. Only call at the beginning of a match!
Definition at line 7 of file StateMachine.cpp.
|
static |
Checks if the state allows the player's current stance.
StateStance | The state's required stance. |
PlayerStance | The current player's stance. |
Definition at line 152 of file StateMachine.cpp.
bool FStateMachine::ForceRollbackState | ( | const FGameplayTag | Name | ) |
Sets the current state for rollback. Code called when entering a state normally will not be called.
Name | The state to set as current. |
Definition at line 140 of file StateMachine.cpp.
bool FStateMachine::ForceSetState | ( | const FGameplayTag | Name, |
bool | bIsAlias = false ) |
Sets the current state. If the state to set is the same as the current state, the state will be reset.
Name | The state to set as current. |
bIsAlias | If the state is being set via an alias. |
Definition at line 73 of file StateMachine.cpp.
bool FStateMachine::ForceSetState | ( | TSubclassOf< UState > | Class, |
bool | bIsAlias = false ) |
Sets the current state. If the state to set is the same as the current state, the state will be reset.
Class | The state to set as current. |
bIsAlias | If the state is being set via an alias. |
Definition at line 106 of file StateMachine.cpp.
int FStateMachine::GetStateIndex | ( | FGameplayTag | Name | ) | const |
Gets the current state index.
Definition at line 29 of file StateMachine.cpp.
FGameplayTag FStateMachine::GetStateName | ( | int | Index | ) |
Gets the current state name.
Definition at line 20 of file StateMachine.cpp.
|
inline |
Checks a name against the current state name.
Definition at line 51 of file StateMachine.h.
bool FStateMachine::SetState | ( | const FGameplayTag | Name, |
bool | bIsAlias = false ) |
Sets the current state. If attempting to set the state to the same as the current state, nothing will happen.
Name | The state to set as current. |
bIsAlias | If the state is being set via an alias. |
Definition at line 34 of file StateMachine.cpp.
void FStateMachine::Update | ( | ) | const |
Calls the current state's exec function.
Definition at line 166 of file StateMachine.cpp.
UState* FStateMachine::CurrentState |
The currently active state.
Definition at line 23 of file StateMachine.h.
APlayerObject* FStateMachine::Parent |
The parent of this state machine.
Definition at line 39 of file StateMachine.h.
TArray<FGameplayTag> FStateMachine::StateNames |
An array of all player state names. Used to lookup states.
Definition at line 34 of file StateMachine.h.
TArray<UState*> FStateMachine::States |
An array of all player states.
Definition at line 28 of file StateMachine.h.