2024-04-13 16:29:25 -07:00
|
|
|
|
#include "GasaEffectActor.h"
|
|
|
|
|
|
2024-04-22 09:01:30 -07:00
|
|
|
|
#include "GasaAbilitySystemComponent_Inlines.h"
|
|
|
|
|
using namespace Gasa;
|
2024-04-13 16:29:25 -07:00
|
|
|
|
|
|
|
|
|
AGasaEffectActor::AGasaEffectActor()
|
|
|
|
|
{
|
|
|
|
|
PrimaryActorTick.bCanEverTick = false;
|
|
|
|
|
|
2024-04-22 09:01:30 -07:00
|
|
|
|
RootComponent = CreateDefaultSubobject<USceneComponent>("Root");
|
2024-04-13 16:29:25 -07:00
|
|
|
|
}
|
|
|
|
|
|
2024-04-22 22:10:02 -07:00
|
|
|
|
void AGasaEffectActor::ApplyEffectToActor(AActor* Actor, TSubclassOf<UGameplayEffect> EffectClass)
|
2024-04-13 16:29:25 -07:00
|
|
|
|
{
|
2024-04-22 22:10:02 -07:00
|
|
|
|
UGasaAbilitySystemComp* AS = GetAbilitySystem(Actor, true);
|
2024-04-13 16:29:25 -07:00
|
|
|
|
|
2024-04-22 09:01:30 -07:00
|
|
|
|
FGameplayEffectContextHandle
|
|
|
|
|
Context = AS->MakeEffectContext();
|
2024-04-22 22:10:02 -07:00
|
|
|
|
Context.AddSourceObject(Actor);
|
2024-04-13 16:29:25 -07:00
|
|
|
|
|
2024-04-22 09:01:30 -07:00
|
|
|
|
FGameplayEffectSpecHandle Spec = AS->MakeOutgoingSpec( EffectClass, 1.0f, Context );
|
|
|
|
|
AS->ApplyGameplayEffectSpecToSelf( * Spec.Data );
|
2024-04-13 16:29:25 -07:00
|
|
|
|
}
|