Locking inputs now happens without being tied to lists in combo input assets.
This commit is contained in:
parent
b1ef780086
commit
74411baaea
@ -84,19 +84,12 @@ void UInputBufferLocalPlayerSubsystem::ActivateComboInput(const UComboInputAsset
|
||||
{
|
||||
// Set the combo input as active.
|
||||
this->InputBufferActive = ComboInput;
|
||||
|
||||
// If we have inputs to lock, prepare the buffer.
|
||||
if (!ComboInput->LockedComboInputs.IsEmpty())
|
||||
{
|
||||
this->LockedComboInputs = ComboInput->LockedComboInputs;
|
||||
|
||||
this->InputBufferHold = nullptr;
|
||||
|
||||
UE_LOG(LogInputBufferLocalPlayerSubsystem, Verbose, TEXT("%s is active."), *ComboInput->ComboInputName.ToString());
|
||||
}
|
||||
else
|
||||
const UInputBufferSubsystemGlobalSettings *Settings = GetDefault<UInputBufferSubsystemGlobalSettings>();
|
||||
for (const TSoftObjectPtr<const UComboInputAsset> &LockedAsset : Settings->ComboActions)
|
||||
{
|
||||
UE_LOG(LogInputBufferLocalPlayerSubsystem, Verbose, TEXT("%s is active and won't lock inputs."), *ComboInput->ComboInputName.ToString());
|
||||
this->LockComboInput(LockedAsset.Get());
|
||||
}
|
||||
|
||||
this->OnNewComboInput.Execute(ComboInput, EComboActionTriggerEvent::Activated);
|
||||
@ -107,6 +100,8 @@ void UInputBufferLocalPlayerSubsystem::ActivateComboInput(const UComboInputAsset
|
||||
{
|
||||
this->OnNewComboInput.Execute(ComboInput, EComboActionTriggerEvent::Released);
|
||||
}
|
||||
|
||||
UE_LOG(LogInputBufferLocalPlayerSubsystem, Verbose, TEXT("%s is active."), *ComboInput->ComboInputName.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -131,6 +126,11 @@ void UInputBufferLocalPlayerSubsystem::HoldComboInput(const UComboInputAsset *Co
|
||||
);
|
||||
}
|
||||
|
||||
void UInputBufferLocalPlayerSubsystem::LockComboInput(const UComboInputAsset *Input)
|
||||
{
|
||||
this->LockedComboInputs.Emplace(Input);
|
||||
}
|
||||
|
||||
void UInputBufferLocalPlayerSubsystem::UnlockComboInput(const UComboInputAsset *Unlocked)
|
||||
{
|
||||
// Remove the newly-unlocked asset from the locked combo inputs.
|
||||
|
||||
@ -120,11 +120,4 @@ public:
|
||||
// this combo input asset will simply represent that action.
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
||||
TSet<const class UInputAction*> ActionGroup;
|
||||
|
||||
// Combo inputs that should be prevented from occurring during this
|
||||
// action. These will be locked when the action is broadcast, and
|
||||
// should be unlocked by the receiving actor by sending an unlock
|
||||
// event.
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
||||
TSet<TObjectPtr<const class UComboInputAsset>> LockedComboInputs;
|
||||
};
|
||||
|
||||
@ -25,6 +25,8 @@ public:
|
||||
|
||||
void AttachComboManager(class UComboManagerComponent *ComboManager, class UEnhancedInputComponent *InputComponent);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void LockComboInput(const class UComboInputAsset *Input);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void UnlockComboInput(const class UComboInputAsset *Unlocked);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user