From b037490ef8b404bc89893528f808ba0d72b8834e Mon Sep 17 00:00:00 2001 From: Ed_ Date: Wed, 24 Apr 2024 11:48:07 -0400 Subject: [PATCH] 42. Infinite Gameplay Effects --- .../Win64/UnrealEditor-GasaEditor.dll | 2 +- .../Gasa/AbilitySystem/GasaEffectActor.cpp | 12 +++++++ .../Gasa/AbilitySystem/GasaEffectActor.h | 35 +++++++++++++++++++ Project/Source/Gasa/GasaCommon.h | 2 ++ 4 files changed, 50 insertions(+), 1 deletion(-) diff --git a/Project/Binaries/Win64/UnrealEditor-GasaEditor.dll b/Project/Binaries/Win64/UnrealEditor-GasaEditor.dll index bfd2082..60e8a91 100644 --- a/Project/Binaries/Win64/UnrealEditor-GasaEditor.dll +++ b/Project/Binaries/Win64/UnrealEditor-GasaEditor.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:36bd29b06747f05f67c12ab6dcce9e0da7f419b2e02c9051327cf1419f07ddbd +oid sha256:a08006e998e3135977ef15159599f237160d46f7bcee5853af42580a568a7464 size 79360 diff --git a/Project/Source/Gasa/AbilitySystem/GasaEffectActor.cpp b/Project/Source/Gasa/AbilitySystem/GasaEffectActor.cpp index fc73561..2fc65af 100644 --- a/Project/Source/Gasa/AbilitySystem/GasaEffectActor.cpp +++ b/Project/Source/Gasa/AbilitySystem/GasaEffectActor.cpp @@ -8,6 +8,10 @@ AGasaEffectActor::AGasaEffectActor() PrimaryActorTick.bCanEverTick = false; RootComponent = CreateDefaultSubobject("Root"); + + InstantEffectUsage = DefaultEffectUsagePolicy; + DurationEffectUsage = DefaultEffectUsagePolicy; + InfiniteEffectUsage = DefaultEffectUsagePolicy; } void AGasaEffectActor::ApplyEffectToActor(AActor* Actor, TSubclassOf EffectClass) @@ -21,3 +25,11 @@ void AGasaEffectActor::ApplyEffectToActor(AActor* Actor, TSubclassOfMakeOutgoingSpec( EffectClass, 1.0f, Context ); AS->ApplyGameplayEffectSpecToSelf( * Spec.Data ); } + +void AGasaEffectActor::OnOverlap(AActor* Actor) +{ +} + +void AGasaEffectActor::OnEndOverlap(AActor* Actor) +{ +} diff --git a/Project/Source/Gasa/AbilitySystem/GasaEffectActor.h b/Project/Source/Gasa/AbilitySystem/GasaEffectActor.h index 24ae180..989992b 100644 --- a/Project/Source/Gasa/AbilitySystem/GasaEffectActor.h +++ b/Project/Source/Gasa/AbilitySystem/GasaEffectActor.h @@ -6,6 +6,20 @@ #include "GasaEffectActor.generated.h" +UENUM(BlueprintType) +enum class EEffectUsagePolicy : uint8 +{ + None = 0 UMETA(Hidden), + ApplyOnOverlap = bit(0), + ApplyOnEndOverlap = bit(1), + DoNotApply = bit(2), + RemoveOnOverlap = bit(3), + RemoveOnEndOverlap = bit(4), + DoNotRemove = bit(5), +}; + +constexpr int32 DefaultEffectUsagePolicy = (int32(EEffectUsagePolicy::DoNotApply) | int32(EEffectUsagePolicy::RemoveOnEndOverlap)); + UCLASS() class GASA_API AGasaEffectActor : public AGasaActor { @@ -14,13 +28,34 @@ public: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Gameplay Effects") TSubclassOf InstantEffectClass; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Gameplay Effects", meta=(Bitmask, BitmaskEnum = EEffectUsagePolicy)) + int32 InstantEffectUsage; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Gameplay Effects") TSubclassOf DurationEffectClass; + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Gameplay Effects", meta=(Bitmask, BitmaskEnum = EEffectUsagePolicy)) + int32 DurationEffectUsage; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Gameplay Effects") + TSubclassOf InfiniteEffectClass; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Gameplay Effects", meta=(Bitmask, BitmaskEnum = EEffectUsagePolicy)) + int32 InfiniteEffectUsage; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Gameplay Effects") + bool bDestroyOnEffectRemoval = false; + AGasaEffectActor(); UFUNCTION(BlueprintCallable, Category = "Gameplay Effects") void ApplyEffectToActor(AActor* Actor, TSubclassOf EffectClass ); + + UFUNCTION(BlueprintCallable) + void OnOverlap(AActor* Actor); + + UFUNCTION(BlueprintCallable) + void OnEndOverlap(AActor* Actor); }; diff --git a/Project/Source/Gasa/GasaCommon.h b/Project/Source/Gasa/GasaCommon.h index 3070e7c..3344200 100644 --- a/Project/Source/Gasa/GasaCommon.h +++ b/Project/Source/Gasa/GasaCommon.h @@ -13,6 +13,8 @@ #define rcast( Type, Value ) reinterpret_cast( Value ) #define scast( Type, Value ) static_cast( Value ) +#define bit(position) (1 << position) + #pragma region Math #define m_pow2( value ) (value * value) #pragma endregion Math