Keep track of tick on landed was called
This commit is contained in:
parent
da392c03fb
commit
d7920802cf
@ -117,6 +117,7 @@ void UFFStateMachineComponent::GoToState(UFFState* NewState, EFFStateFinishReaso
|
||||
|
||||
CurrentState->Exit(GetCurrentStateContext(), StateFinishReason);
|
||||
TicksInState = 0;
|
||||
OnLandedTick = 0;
|
||||
TickStateWasEntered = GetWorld()->GetGameState<AFFGameState>()->GetCurrentTick();
|
||||
CurrentSubStateLabel = NAME_None;
|
||||
NewState->Enter(GetCurrentStateContext());
|
||||
@ -161,6 +162,8 @@ void UFFStateMachineComponent::Landed(const FHitResult& Hit)
|
||||
{
|
||||
check(CurrentState)
|
||||
|
||||
OnLandedTick = GetWorld()->GetGameState<AFFGameState>()->GetCurrentTick();
|
||||
|
||||
CurrentState->Landed(Hit, GetCurrentStateContext());
|
||||
}
|
||||
|
||||
|
@ -104,6 +104,14 @@ public:
|
||||
UFUNCTION(BlueprintPure)
|
||||
FORCEINLINE int64 GetTickStateWasEntered() const { return TickStateWasEntered; }
|
||||
|
||||
/**
|
||||
* Returns the tick number which corresponds to when the On Landed event fired
|
||||
*
|
||||
* The tick number represents the ticks that have elapsed since the game began.
|
||||
*/
|
||||
UFUNCTION(BlueprintPure)
|
||||
FORCEINLINE int64 GetOnLandedTick() const { return OnLandedTick; }
|
||||
|
||||
UFUNCTION(BlueprintPure)
|
||||
const UFFState* GetCurrentState() const { return const_cast<UFFState*>(CurrentState); }
|
||||
|
||||
@ -158,12 +166,19 @@ protected:
|
||||
int64 TicksInState;
|
||||
|
||||
/**
|
||||
* The tick number which corresponds to when this state was entered into.
|
||||
* The tick number which corresponds to when the current state was entered.
|
||||
*
|
||||
* The tick number represents the ticks that have elapsed since the game began.
|
||||
*/
|
||||
int64 TickStateWasEntered;
|
||||
|
||||
/**
|
||||
* The tick number which corresponds to when the On Landed event was called for the current tick.
|
||||
*
|
||||
* The tick number represents the ticks that have elapsed since the game began.
|
||||
*/
|
||||
int64 OnLandedTick;
|
||||
|
||||
/** Current active state for this state machine */
|
||||
UPROPERTY()
|
||||
UFFState* CurrentState;
|
||||
@ -171,6 +186,7 @@ protected:
|
||||
/** Current SubState label or NAME_None if there is no SubState label set for the current state*/
|
||||
FName CurrentSubStateLabel;
|
||||
|
||||
// TODO: should be a TMap
|
||||
// States that have been added
|
||||
UPROPERTY()
|
||||
TArray<UFFState*> States;
|
||||
|
Loading…
Reference in New Issue
Block a user