diff --git a/Source/UnrealFightingFramework/Input/FFInputBufferComponent.cpp b/Source/UnrealFightingFramework/Input/FFInputBufferComponent.cpp index a1f9b9c..f767b1d 100644 --- a/Source/UnrealFightingFramework/Input/FFInputBufferComponent.cpp +++ b/Source/UnrealFightingFramework/Input/FFInputBufferComponent.cpp @@ -14,11 +14,30 @@ void UFFInputBufferComponent::AddInput(const FFFInputState& InputState) bool UFFInputBufferComponent::CheckInputSequence(const FFFInputCondition& InputCondition) { + int CondIdx = InputCondition.Sequence.Num() - 1; + int FramesSinceValidInput = 0; for(int InpIdx = 0; InpIdx < InputBuffer.Num(); InpIdx++) { - // read input sequence - FFFInputState CurrInput = InputBuffer[InpIdx]; + int32 CurrCondition = InputCondition.Sequence[CondIdx].Buttons; + int32 ThisInput = InputBuffer[InpIdx].Buttons; + if(ThisInput & CurrCondition) + { + CondIdx--; + FramesSinceValidInput = 0; + } + + // All conditions were met + if(CondIdx == -1) + { + return true; + } + + FramesSinceValidInput++; + if(FramesSinceValidInput > InputCondition.Lenience) + { + return false; + } } - return true; + return false; } diff --git a/Source/UnrealFightingFramework/Input/FFPlayerController.cpp b/Source/UnrealFightingFramework/Input/FFPlayerController.cpp index 57c5b7d..9d40713 100644 --- a/Source/UnrealFightingFramework/Input/FFPlayerController.cpp +++ b/Source/UnrealFightingFramework/Input/FFPlayerController.cpp @@ -29,7 +29,6 @@ void AFFPlayerController::FixedTick(float OneFrame) { //UnacknowledgedInputs.Push(RawInput); InputBuffer->AddInput(ModifiedInput); - //SendInputsToRemote(); }