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

24 lines
655 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
}
void AGasaEffectActor::ApplyEffectToActor(AActor* Actor, TSubclassOf<UGameplayEffect> EffectClass)
2024-04-13 16:29:25 -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();
Context.AddSourceObject(Actor);
2024-04-24 07:59:48 -07:00
2024-04-22 09:01:30 -07:00
FGameplayEffectSpecHandle Spec = AS->MakeOutgoingSpec( EffectClass, 1.0f, Context );
2024-04-24 07:59:48 -07:00
AS->ApplyGameplayEffectSpecToSelf( * Spec.Data );
2024-04-13 16:29:25 -07:00
}