本文整理汇总了C++中FGAGameEffectHandle::GetEffect方法的典型用法代码示例。如果您正苦于以下问题:C++ FGAGameEffectHandle::GetEffect方法的具体用法?C++ FGAGameEffectHandle::GetEffect怎么用?C++ FGAGameEffectHandle::GetEffect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FGAGameEffectHandle
的用法示例。
在下文中一共展示了FGAGameEffectHandle::GetEffect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ApplyEffect
void FGAGameEffectContainer::ApplyEffect(const FGAGameEffect& EffectIn
, const FGAGameEffectHandle& HandleIn)
{
//instant effect goes trough simplest application path
//just make effect and run it trough modifiers.
//FGAGameEffect Effect = EfNoConst.Calculation->ModiifyEffect(EffectIn);
switch (EffectIn.GameEffect->EffectType)
{
case EGAEffectType::Instant:
{
//dont do anything fancy now simply execute effect and forget about it.
HandleIn.GetContext().TargetComp->ExecuteEffect(HandleIn);
break;
}
case EGAEffectType::Periodic:
{
UE_LOG(GameAttributesEffects, Log, TEXT("UGAAttributeComponent:: Apply periodic effect"));
InternalCheckPeriodicEffectStacking(HandleIn);
break;
}
case EGAEffectType::Duration:
{
UE_LOG(GameAttributesEffects, Log, TEXT("UGAAttributeComponent:: Apply effect for duration"));
InternalCheckDurationEffectStacking(HandleIn);
break;
}
case EGAEffectType::Infinite:
{
break;
}
default:
break;
}
//apply additonal effect applied with this effect.
for (TSubclassOf<UGAGameEffectSpec> Spec : EffectIn.GameEffect->OnAppliedEffects)
{
FGAGameEffectHandle Handle = EffectIn.Context.TargetComp->MakeGameEffect(Spec, EffectIn.Context);
EffectIn.Context.InstigatorComp->ApplyEffectToTarget(Handle.GetEffect(), Handle);
}
//regardless of what happen try to apply effect modifiers
for (FGAGameEffectModifier& mod : EffectIn.GameEffect->Modifiers)
{
ApplyEffectModifier(mod, HandleIn);
}
}
示例2: ExecuteEffect
void UGAAttributeComponent::ExecuteEffect(FGAGameEffectHandle HandleIn)
{
/*
this patth will give effects chance to do any replicated events, like applying cues.
WE do not make any replication at the ApplyEffect because some effect might want to apply cues
on periods on expiration etc, and all those will go trouch ExecuteEffect path.
*/
OnEffectExecuted.Broadcast(HandleIn);
FGAGameEffect Effect = HandleIn.GetEffect();
TArray<FGAEffectMod> Mods = Effect.GetOnAppliedMods();
FGAExecutionContext ExecContext(Effect.Context.TargetComp.Get(), Effect.Context.TargetComp->DefaultAttributes,
Effect.Context.InstigatorComp.Get(), Effect.Context.InstigatorComp->DefaultAttributes);
for (FGAEffectMod& mod : Mods)
{
HandleIn.ExecuteEffect(HandleIn, mod, ExecContext);
}
//GameEffectContainer.ExecuteEffect(HandleIn, HandleIn.GetEffectRef());
}
示例3: ApplyEffect
void FGAGameEffectContainer::ApplyEffect(const FGAGameEffect& EffectIn
, const FGAGameEffectHandle& HandleIn)
{
//instant effect goes trough simplest application path
//just make effect and run it trough modifiers.
//FGAGameEffect Effect = EfNoConst.Calculation->ModiifyEffect(EffectIn);
switch (EffectIn.GameEffect->EffectType)
{
case EGAEffectType::Instant:
{
//dont do anything fancy now simply execute effect and forget about it.
HandleIn.GetContext().TargetComp->ExecuteEffect(HandleIn);
break;
}
case EGAEffectType::Periodic:
{
UE_LOG(GameAttributesEffects, Log, TEXT("UGAAttributeComponent:: Apply periodic effect"));
/*FTimerDelegate del = FTimerDelegate::CreateUObject(HandleIn.GetContext().TargetComp.Get(), &UGAAttributeComponent::ExecuteEffect, HandleIn);
FTimerManager& timer = HandleIn.GetEffectRef().Context.TargetComp->GetWorld()->GetTimerManager();
timer.SetTimer(HandleIn.GetEffectRef().PeriodTimerHandle, del,
EffectIn.GameEffect->Period, true, 0);
FTimerDelegate delDuration = FTimerDelegate::CreateUObject(HandleIn.GetContext().TargetComp.Get(), &UGAAttributeComponent::ExpireEffect, HandleIn);
FTimerManager& timerDuration = HandleIn.GetEffectRef().Context.TargetComp->GetWorld()->GetTimerManager();
timerDuration.SetTimer(HandleIn.GetEffectRef().DurationTimerHandle, delDuration,
EffectIn.GameEffect->Duration, false);*/
InternalCheckEffectStacking(HandleIn);
InternalApplyModifiers(HandleIn);
break;
}
case EGAEffectType::Duration:
{
UE_LOG(GameAttributesEffects, Log, TEXT("UGAAttributeComponent:: Apply effect for duration"));
HandleIn.GetContextRef().TargetComp->ApplyEffectForDuration(HandleIn);
FTimerDelegate delDuration = FTimerDelegate::CreateUObject(HandleIn.GetContext().TargetComp.Get(), &UGAAttributeComponent::ExpireEffect, HandleIn);
FTimerManager& timerDuration = HandleIn.GetEffectRef().Context.TargetComp->GetWorld()->GetTimerManager();
timerDuration.SetTimer(HandleIn.GetEffectRef().DurationTimerHandle, delDuration,
EffectIn.GameEffect->Duration, false);
InternalCheckEffectStacking(HandleIn);
InternalApplyModifiers(HandleIn);
break;
}
default:
break;
}
//apply additonal effect applied with this effect.
for (TSubclassOf<UGAGameEffectSpec> Spec : EffectIn.GameEffect->OnAppliedEffects)
{
FGAGameEffectHandle Handle = EffectIn.Context.TargetComp->MakeGameEffect(Spec, EffectIn.Context);
EffectIn.Context.TargetComp->ApplyEffectToSelf(Handle.GetEffect(), Handle);
}
//regardless of what happen try to apply effect modifiers
for (FGAGameEffectModifier& mod : EffectIn.GameEffect->Modifiers)
{
ApplyModifier(mod, EffectIn);
}
}