document.write("
#pragma once
#include "EnhancedInputComponent.h"
#include "InputActionGameplayAbilityMappings.generated.h"
enum class ETriggerEvent : uint8;
class UInputActionGameplayAbility;
class UInputAction;
class UGameplayAbility;
/**
* Struct representing the mapping from GameplayAbilityClass to the InputAction and the specific InputAction
* TriggerEvent that activates it.
*/
USTRUCT(NotBlueprintable)
struct FInputActionGameplayAbilityMappingData
{
GENERATED_BODY()
/**
* The GameplayAbility class that will be bound to the provided InputAction.
*/
UPROPERTY(EditAnywhere, Category = "InputActionGameplayAbilityMappingData")
TSubclassOf<UGameplayAbility> GameplayAbilityClass;
/**
* The InputAction that will activate the GameplayAbilityClass.
*/
UPROPERTY(EditAnywhere, Category = "InputActionGameplayAbilityMappingData")
TObjectPtr<UInputAction> InputAction;
/**
* The specific TriggerEvent on the InputAction that will activate the GameplayAbility. Supported values are None,
* Triggered, and Started.
*/
UPROPERTY(
EditAnywhere,
Category= "InputActionGameplayAbilityMappingData",
meta=(ValidEnumValues="None, Triggered, Started")
)
ETriggerEvent TriggerType = ETriggerEvent::None;
/**
* An automatically generated ID that will be used to trigger the GA on the ASC.
*/
UPROPERTY(VisibleAnywhere, Category = "GameplayInputAbilityInfo")
int32 InputID = 0;
/**
* Only returns true if the GameplayAbilityClass and InputAction are not null and the TriggerType is not None.
* @return True if the above conditions are met. False otherwise.
*/
bool IsValid() const;
/**
* Returns true if the GameplayAbilityClass, InputAction, and TriggerType are all identical values.
* @param Other The other FInputActionGameplayAbilityMappingData to be compared to.
* @return True if all values are equal. False otherwise.
*/
bool operator==(const FInputActionGameplayAbilityMappingData& Other) const;
/**
* Returns false when the == operator would return true and vice-versa.
* @param Other The other FInputActionGameplayAbilityMappingData to be compared to.
* @return False if all values are equal. True otherwise.
*/
bool operator!=(const FInputActionGameplayAbilityMappingData& Other) const { return !operator==(Other); }
/**
* Generates a hash for the provided item for hashing into sets/maps/etc. Instances that are equal will
* generate the same hash.
* @param Item The item to be hashed.
* @return A hashing value for use with sets/maps/etc.
*/
friend uint32 GetTypeHash(const FInputActionGameplayAbilityMappingData& Item);
};
/**
* DataAsset class containing the mappings from InputActions to GameplayAbilities.
*/
UCLASS()
class DANDELION_API UInputActionGameplayAbilityMappings : public UDataAsset
{
GENERATED_BODY()
/**
* The actual mapping data itself.
*/
UPROPERTY(EditDefaultsOnly)
TSet<FInputActionGameplayAbilityMappingData> Mappings;
public:
/**
* Simple getter that returns the Set of FInputActionGameplayAbilityMappingData.
* @return
*/
FORCEINLINE const TSet<FInputActionGameplayAbilityMappingData>& GetMappings() const { return Mappings; }
/**
* Used to find a specific FInputActionGameplayAbilityMappingData that corresponds to a provided GameplayAbility
* class.
* @param TargetGameplayAbilityClass The GameplayAbilityClass to be searched for.
* @return The FInputActionGameplayAbilityMappingData that matches the UGameplayAbility class, or nullptr if none is
* found.
*/
FInputActionGameplayAbilityMappingData* GetMappingDataByGameplayAbilityClass(
const TSubclassOf<UGameplayAbility>& TargetGameplayAbilityClass
) const;
#if WITH_EDITOR
/**
* Checks to see if the Mappings property has been changed. If new InputIDs need to be generated, then do so.
* @param PropertyChangedEvent Data that accompanies the property change describing the event.
*/
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
#endif
};
InputActionGameplayAbilityMappings.h - Snippet hosted by \"Cacher\"
");