mirror of
https://github.com/Ed94/Cog.git
synced 2026-08-05 07:08:46 +00:00
started to add effects in hud on the sample
This commit is contained in:
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 FGameplayEffectSpec;
|
||||||
struct FOnAttributeChangeData;
|
struct FOnAttributeChangeData;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FCogSampleCooldownUpdateEventDelegate, const UGameplayAbility*, Ability, float, Duration, float, TimeRemaining);
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
USTRUCT(BlueprintType)
|
USTRUCT(BlueprintType)
|
||||||
struct FActiveAbilityInfo
|
struct FActiveAbilityInfo
|
||||||
@@ -216,8 +214,11 @@ public:
|
|||||||
UPROPERTY(BlueprintAssignable)
|
UPROPERTY(BlueprintAssignable)
|
||||||
FCogSampleDamageEventDelegate OnDamageReceived;
|
FCogSampleDamageEventDelegate OnDamageReceived;
|
||||||
|
|
||||||
UPROPERTY(BlueprintAssignable)
|
//UPROPERTY(BlueprintAssignable)
|
||||||
FCogSampleCooldownUpdateEventDelegate OnCooldownUpdated;
|
//FCogSampleGameplayEffectAddedEventDelegate OnEffectAdded;
|
||||||
|
|
||||||
|
//UPROPERTY(BlueprintAssignable)
|
||||||
|
//FCogSampleGameplayEffectRemovedEventDelegate OnEffectRemoved;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
// Root Motion
|
// 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