From 50a3bd8a4b73877c7028733fd942e50e12db6d55 Mon Sep 17 00:00:00 2001 From: Kevin Poretti Date: Tue, 30 Jan 2024 21:20:23 -0500 Subject: [PATCH] Automatically go to a followup state when curr state ends --- Source/UnrealFightingFramework/State/FFState.cpp | 10 +++++++++- Source/UnrealFightingFramework/State/FFState.h | 7 +++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Source/UnrealFightingFramework/State/FFState.cpp b/Source/UnrealFightingFramework/State/FFState.cpp index c65d4d5..3609899 100644 --- a/Source/UnrealFightingFramework/State/FFState.cpp +++ b/Source/UnrealFightingFramework/State/FFState.cpp @@ -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 // to rethink the way we handle logic for ending a state and which class is in charge of handling // what - InStateContext.Parent->GoToEntryState(StateFinishReason); + if(FollowupState != NAME_None) + { + InStateContext.Parent->GoToState(FollowupState, StateFinishReason); + } + else + { + InStateContext.Parent->GoToEntryState(StateFinishReason); + } + } diff --git a/Source/UnrealFightingFramework/State/FFState.h b/Source/UnrealFightingFramework/State/FFState.h index 18e5243..62bc2e3 100644 --- a/Source/UnrealFightingFramework/State/FFState.h +++ b/Source/UnrealFightingFramework/State/FFState.h @@ -126,6 +126,13 @@ public: UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category="UFF State Properties") 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 */