diff --git a/Source/UnrealFightingFramework/GameplayFramework/FFAIController.cpp b/Source/UnrealFightingFramework/GameplayFramework/FFAIController.cpp index 755b91b..dd45e4b 100644 --- a/Source/UnrealFightingFramework/GameplayFramework/FFAIController.cpp +++ b/Source/UnrealFightingFramework/GameplayFramework/FFAIController.cpp @@ -5,6 +5,7 @@ AFFAIController::AFFAIController() { + InputBuffer = CreateDefaultSubobject(TEXT("InputBuffer")); bWantsPlayerState = true; } @@ -25,5 +26,6 @@ FVector AFFAIController::GetInputAsWorldDirection() const void AFFAIController::DisableMostRecentInput() { + check(InputBuffer); InputBuffer->DisableMostRecentInput(); } diff --git a/Source/UnrealFightingFramework/Input/FFInputBufferComponent.cpp b/Source/UnrealFightingFramework/Input/FFInputBufferComponent.cpp index 3ab4529..9c7e64b 100644 --- a/Source/UnrealFightingFramework/Input/FFInputBufferComponent.cpp +++ b/Source/UnrealFightingFramework/Input/FFInputBufferComponent.cpp @@ -97,6 +97,11 @@ bool UFFInputBufferComponent::CheckInputSequence(const FFFInputSequence& InputSe void UFFInputBufferComponent::DisableMostRecentInput() { + if(InputBuffer.Num() < 2) + { + return; + } + InputBuffer[InputBuffer.Num() - 1].DisabledButtons |= InputBuffer[InputBuffer.Num() - 1].Buttons; InputBuffer[InputBuffer.Num() - 2].DisabledButtons |= InputBuffer[InputBuffer.Num() - 2].Buttons; }