Initialize Git with LFS for binary assets and add standard Unreal Engine .gitignore/.gitattributes. Co-authored-by: Cursor <cursoragent@cursor.com>
37 lines
1.3 KiB
C++
37 lines
1.3 KiB
C++
// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
|
|
|
|
#include "Actors/RIREffectActor.h"
|
|
#include "GameplayEffect.h"
|
|
#include "AbilitySystemComponent.h"
|
|
#include "AbilitySystemBlueprintLibrary.h"
|
|
|
|
// Sets default values
|
|
ARIREffectActor::ARIREffectActor()
|
|
{
|
|
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
|
|
PrimaryActorTick.bCanEverTick = true;
|
|
|
|
SetRootComponent(CreateDefaultSubobject<USceneComponent>("SceneRoot"));
|
|
|
|
}
|
|
|
|
|
|
// Called when the game starts or when spawned
|
|
void ARIREffectActor::BeginPlay()
|
|
{
|
|
Super::BeginPlay();
|
|
|
|
}
|
|
|
|
void ARIREffectActor::ApplyEffectToTarget(AActor* TargetActor, TSubclassOf<UGameplayEffect> GamePlayEffectClass)
|
|
{
|
|
UAbilitySystemComponent* TargetAbilitySystemComponent = UAbilitySystemBlueprintLibrary::GetAbilitySystemComponent(TargetActor);
|
|
if (TargetAbilitySystemComponent == nullptr) return;
|
|
|
|
check (GamePlayEffectClass);
|
|
FGameplayEffectContextHandle EffectContextHandle = TargetAbilitySystemComponent->MakeEffectContext();
|
|
EffectContextHandle.AddSourceObject(this);
|
|
const FGameplayEffectSpecHandle EffectSpecHandle = TargetAbilitySystemComponent->MakeOutgoingSpec(GamePlayEffectClass, 1.f, EffectContextHandle);
|
|
TargetAbilitySystemComponent->ApplyGameplayEffectSpecToSelf(*EffectSpecHandle.Data.Get());
|
|
}
|