Added some extra helper functions to UComboInputAsset, and cleaned up some others.
This commit is contained in:
parent
2032b8d23b
commit
9809c36513
@ -3,7 +3,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
#include "Engine/DataAsset.h"
|
||||
|
||||
#include "ComboInputAssets.generated.h"
|
||||
|
||||
|
||||
@ -72,15 +74,11 @@ public:
|
||||
// action group.
|
||||
bool MatchesInputAction(const class UInputAction* Action) const
|
||||
{
|
||||
if (this->ActionGroup.Num() == 1 && this->ActionGroup.Contains(Action))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return (this->ActionGroup.Num() == 1 && this->ActionGroup.Contains(Action));
|
||||
}
|
||||
// Checks if this combo input's action group contains all of the given actions, and no
|
||||
// others.
|
||||
bool MatchesInputActions(TSet<const class UInputAction *> Actions) const
|
||||
bool MatchesInputActions(TSet<const class UInputAction*> Actions) const
|
||||
{
|
||||
if (this->ActionGroup.Num() == Actions.Num())
|
||||
{
|
||||
@ -95,6 +93,23 @@ public:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Checks if this combo input's action group contains the given action.
|
||||
bool ContainsAction(const class UInputAction* Action) const
|
||||
{
|
||||
return this->ActionGroup.Contains(Action);
|
||||
}
|
||||
// Checks if this combo input's action group contains any of the given actions.
|
||||
bool ContainsOneOf(TSet<const class UInputAction*> Actions) const
|
||||
{
|
||||
for (const UInputAction *Action : Actions)
|
||||
{
|
||||
if (this->ActionGroup.Contains(Action))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Human-readable name of this combo input.
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user