GASATHON/Project/Source/Gasa/AbilitySystem/GasaEffectActor.cpp

24 lines
660 B
C++
Raw Normal View History

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 09:01:30 -07:00
void AGasaEffectActor::ApplyEffectToTarget(AActor* Target, TSubclassOf<UGameplayEffect> EffectClass)
2024-04-13 16:29:25 -07:00
{
2024-04-22 09:01:30 -07:00
UGasaAbilitySystemComp* AS = GetAbilitySystem(Target, true);
2024-04-13 16:29:25 -07:00
2024-04-22 09:01:30 -07:00
FGameplayEffectContextHandle
Context = AS->MakeEffectContext();
Context.AddSourceObject(Target);
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
}