Automatically go to a followup state when curr state ends

This commit is contained in:
Kevin Poretti 2024-01-30 21:20:23 -05:00
parent ea8e26e77d
commit 50a3bd8a4b
2 changed files with 16 additions and 1 deletions

View File

@ -163,7 +163,15 @@ void UFFState::Finish(const FFFStateContext& InStateContext, EFFStateFinishReaso
// the appropriate flags are set. I think having this state finish reason is good but I may want // the appropriate flags are set. I think having this state finish reason is good but I may want
// to rethink the way we handle logic for ending a state and which class is in charge of handling // to rethink the way we handle logic for ending a state and which class is in charge of handling
// what // what
InStateContext.Parent->GoToEntryState(StateFinishReason); if(FollowupState != NAME_None)
{
InStateContext.Parent->GoToState(FollowupState, StateFinishReason);
}
else
{
InStateContext.Parent->GoToEntryState(StateFinishReason);
}
} }

View File

@ -126,6 +126,13 @@ public:
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category="UFF State Properties") UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category="UFF State Properties")
bool bCanTransitionToSelf = false; bool bCanTransitionToSelf = false;
/**
* State to transition to when this state is finished. If left blank then the entry state
* of the state machine will be transitioned into.
*/
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category="UFF State Properties")
FName FollowupState = NAME_None;
/** /**
* Animation to begin playing when this state is entered * Animation to begin playing when this state is entered
*/ */