- Added a header file to prevent an error when creating a shipping build.

- Added comments to help describe what the various data assets do.
This commit is contained in:
Jamie Greunbaum 2023-09-10 15:13:30 -04:00
parent 90af002272
commit 2032b8d23b

View File

@ -3,9 +3,14 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataAsset.h"
#include "ComboInputAssets.generated.h"
/**
* Struct that is used as the value for a combo branch. ComboAction is the action to be
* executed, and NextNode is the node that will be activated next in the sequence.
*/
USTRUCT(BlueprintType)
struct COMBOINPUT_API FComboSequenceAction
{
@ -20,6 +25,11 @@ public:
TObjectPtr<const class UComboSequenceNode> NextNode;
};
/**
* An action that can be executed as part of a combo sequence. This is essentially a
* representation of an attack, and can be sent to the Animation Graph to play an
* attack animation and the like.
*/
UCLASS(BlueprintType)
class COMBOINPUT_API UComboAction : public UDataAsset
{
@ -31,6 +41,11 @@ public:
FName ActionName;
};
/**
* This represents a node in the combo graph, with each key in the ComboBranch being
* an input this node can react to, and each value containing the action to be executed
* next, and the node to activate after the action is complete.
*/
UCLASS(BlueprintType)
class COMBOINPUT_API UComboSequenceNode : public UDataAsset
{
@ -41,12 +56,20 @@ public:
TMap<const class UComboInputAsset *, struct FComboSequenceAction> ComboBranch;
};
/**
* This maps a sequence of button inputs from EnhancedInput to a combo action that can
* be used to execute a sequence of moves. This gets sent from the input buffer subsystem
* to the player controller's ComboManagerComponent, which executes the associated action
* in the current ComboSequenceNode.
*/
UCLASS(BlueprintType)
class COMBOINPUT_API UComboInputAsset : public UDataAsset
{
GENERATED_BODY()
public:
// Checks if this combo input contains the given action, and only that action, in its
// action group.
bool MatchesInputAction(const class UInputAction* Action) const
{
if (this->ActionGroup.Num() == 1 && this->ActionGroup.Contains(Action))
@ -55,6 +78,8 @@ public:
}
return false;
}
// 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
{
if (this->ActionGroup.Num() == Actions.Num())