started to add effects in hud on the sample
This commit is contained in:
1 parent
b3a230343b
commit
99db2cfd5e
10 files changed
+91
-4
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
#include "CogSampleTask_ListenForGameplayEffectChanges.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
UCogSampleTask_ListenForGameplayEffectChanges* UCogSampleTask_ListenForGameplayEffectChanges::ListenForGameplayEffectChanges(UAbilitySystemComponent* AbilitySystemComponent)
|
||||
{
|
||||
if (!IsValid(AbilitySystemComponent))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UCogSampleTask_ListenForGameplayEffectChanges* WaitForGameplayEffectChangesTask = NewObject<UCogSampleTask_ListenForGameplayEffectChanges>();
|
||||
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);
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
};
|
||||
Reference in new issue
Block a user