diff --git a/Content/Characters/Creature2/Attributes/GE_Creature2_Attributes.uasset b/Content/Characters/Creature2/Attributes/GE_Creature2_Attributes.uasset index 1f74983..fed6e8f 100644 Binary files a/Content/Characters/Creature2/Attributes/GE_Creature2_Attributes.uasset and b/Content/Characters/Creature2/Attributes/GE_Creature2_Attributes.uasset differ diff --git a/Content/Core/Debug/Cheats/GE_Cheat_God.uasset b/Content/Core/Debug/Cheats/GE_Cheat_God.uasset index 6bb0693..73710df 100644 Binary files a/Content/Core/Debug/Cheats/GE_Cheat_God.uasset and b/Content/Core/Debug/Cheats/GE_Cheat_God.uasset differ diff --git a/Content/Core/Effects/BP_EffectUIData.uasset b/Content/Core/Effects/BP_EffectUIData.uasset new file mode 100644 index 0000000..90eb9c9 Binary files /dev/null and b/Content/Core/Effects/BP_EffectUIData.uasset differ diff --git a/Content/Core/Hud/WBP_Ability.uasset b/Content/Core/Hud/WBP_Ability.uasset index 9bde073..23e0c52 100644 Binary files a/Content/Core/Hud/WBP_Ability.uasset and b/Content/Core/Hud/WBP_Ability.uasset differ diff --git a/Content/Core/Hud/WBP_Effect.uasset b/Content/Core/Hud/WBP_Effect.uasset new file mode 100644 index 0000000..ae274ed Binary files /dev/null and b/Content/Core/Hud/WBP_Effect.uasset differ diff --git a/Content/Core/Hud/WBP_EffectPanel.uasset b/Content/Core/Hud/WBP_EffectPanel.uasset new file mode 100644 index 0000000..50e26ca Binary files /dev/null and b/Content/Core/Hud/WBP_EffectPanel.uasset differ diff --git a/Content/Core/Hud/WBP_Hud.uasset b/Content/Core/Hud/WBP_Hud.uasset index 21451c2..91106c1 100644 Binary files a/Content/Core/Hud/WBP_Hud.uasset and b/Content/Core/Hud/WBP_Hud.uasset differ diff --git a/Source/CogSample/CogSampleCharacter.h b/Source/CogSample/CogSampleCharacter.h index d479647..a23497b 100644 --- a/Source/CogSample/CogSampleCharacter.h +++ b/Source/CogSample/CogSampleCharacter.h @@ -29,8 +29,6 @@ struct FCogSampleRootMotionParams; struct FGameplayEffectSpec; struct FOnAttributeChangeData; -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FCogSampleCooldownUpdateEventDelegate, const UGameplayAbility*, Ability, float, Duration, float, TimeRemaining); - //-------------------------------------------------------------------------------------------------------------------------- USTRUCT(BlueprintType) struct FActiveAbilityInfo @@ -216,8 +214,11 @@ public: UPROPERTY(BlueprintAssignable) FCogSampleDamageEventDelegate OnDamageReceived; - UPROPERTY(BlueprintAssignable) - FCogSampleCooldownUpdateEventDelegate OnCooldownUpdated; + //UPROPERTY(BlueprintAssignable) + //FCogSampleGameplayEffectAddedEventDelegate OnEffectAdded; + + //UPROPERTY(BlueprintAssignable) + //FCogSampleGameplayEffectRemovedEventDelegate OnEffectRemoved; //---------------------------------------------------------------------------------------------------------------------- // Root Motion diff --git a/Source/CogSample/CogSampleTask_ListenForGameplayEffectChanges.cpp b/Source/CogSample/CogSampleTask_ListenForGameplayEffectChanges.cpp new file mode 100644 index 0000000..43cfa06 --- /dev/null +++ b/Source/CogSample/CogSampleTask_ListenForGameplayEffectChanges.cpp @@ -0,0 +1,47 @@ +#include "CogSampleTask_ListenForGameplayEffectChanges.h" + +//-------------------------------------------------------------------------------------------------------------------------- +UCogSampleTask_ListenForGameplayEffectChanges* UCogSampleTask_ListenForGameplayEffectChanges::ListenForGameplayEffectChanges(UAbilitySystemComponent* AbilitySystemComponent) +{ + if (!IsValid(AbilitySystemComponent)) + { + return nullptr; + } + + UCogSampleTask_ListenForGameplayEffectChanges* WaitForGameplayEffectChangesTask = NewObject(); + WaitForGameplayEffectChangesTask->AbilitySystemComponent = AbilitySystemComponent; + + return WaitForGameplayEffectChangesTask; +} + +//-------------------------------------------------------------------------------------------------------------------------- +void UCogSampleTask_ListenForGameplayEffectChanges::Activate() +{ + AbilitySystemComponent->OnActiveGameplayEffectAddedDelegateToSelf.AddUObject(this, &UCogSampleTask_ListenForGameplayEffectChanges::OnGameplayEffectAdded); + AbilitySystemComponent->OnAnyGameplayEffectRemovedDelegate().AddUObject(this, &UCogSampleTask_ListenForGameplayEffectChanges::OnGameplayEffectRemoved); +} + +//-------------------------------------------------------------------------------------------------------------------------- +void UCogSampleTask_ListenForGameplayEffectChanges::EndTask() +{ + if (IsValid(AbilitySystemComponent)) + { + AbilitySystemComponent->OnActiveGameplayEffectAddedDelegateToSelf.RemoveAll(this); + AbilitySystemComponent->OnAnyGameplayEffectRemovedDelegate().RemoveAll(this); + } + + SetReadyToDestroy(); + MarkAsGarbage(); +} + +//-------------------------------------------------------------------------------------------------------------------------- +void UCogSampleTask_ListenForGameplayEffectChanges::OnGameplayEffectAdded(UAbilitySystemComponent* InAbilitySystemComponent, const FGameplayEffectSpec& GameplayEffectSpec, FActiveGameplayEffectHandle Handle) +{ + OnAdded.Broadcast(Handle); +} + +//-------------------------------------------------------------------------------------------------------------------------- +void UCogSampleTask_ListenForGameplayEffectChanges::OnGameplayEffectRemoved(const FActiveGameplayEffect& RemovedGameplayEffect) +{ + OnRemoved.Broadcast(RemovedGameplayEffect.Handle); +} \ No newline at end of file diff --git a/Source/CogSample/CogSampleTask_ListenForGameplayEffectChanges.h b/Source/CogSample/CogSampleTask_ListenForGameplayEffectChanges.h new file mode 100644 index 0000000..6929bb3 --- /dev/null +++ b/Source/CogSample/CogSampleTask_ListenForGameplayEffectChanges.h @@ -0,0 +1,39 @@ +#pragma once + +#include "CoreMinimal.h" +#include "AbilitySystemComponent.h" +#include "Kismet/BlueprintAsyncActionBase.h" + +#include "CogSampleTask_ListenForGameplayEffectChanges.generated.h" + +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FCogSampleOnGameplayEffectChangesDelegate, FActiveGameplayEffectHandle, Handle) +; +UCLASS(BlueprintType, meta = (ExposedAsyncProxy = AsyncTask)) +class UCogSampleTask_ListenForGameplayEffectChanges : public UBlueprintAsyncActionBase +{ + GENERATED_BODY() +public: + + UPROPERTY(BlueprintAssignable) + FCogSampleOnGameplayEffectChangesDelegate OnAdded; + + UPROPERTY(BlueprintAssignable) + FCogSampleOnGameplayEffectChangesDelegate OnRemoved; + + UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true")) + static UCogSampleTask_ListenForGameplayEffectChanges* ListenForGameplayEffectChanges(UAbilitySystemComponent* AbilitySystemComponent); + + virtual void Activate() override; + + UFUNCTION(BlueprintCallable) + void EndTask(); + +protected: + + UPROPERTY() + UAbilitySystemComponent* AbilitySystemComponent = nullptr; + + void OnGameplayEffectAdded(UAbilitySystemComponent* AbilitySystemComponent, const FGameplayEffectSpec& GameplayEffectSpec, FActiveGameplayEffectHandle Handle); + void OnGameplayEffectRemoved(const FActiveGameplayEffect& RemovedGameplayEffect); + +}; \ No newline at end of file