本文整理汇总了C++中FGAGameEffectHandle::GetContext方法的典型用法代码示例。如果您正苦于以下问题:C++ FGAGameEffectHandle::GetContext方法的具体用法?C++ FGAGameEffectHandle::GetContext怎么用?C++ FGAGameEffectHandle::GetContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FGAGameEffectHandle
的用法示例。
在下文中一共展示了FGAGameEffectHandle::GetContext方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InternalApplyPeriodic
void FGAGameEffectContainer::InternalApplyPeriodic(const FGAGameEffectHandle& HandleIn)
{
FTimerDelegate delPeriod = FTimerDelegate::CreateUObject(HandleIn.GetContext().TargetComp.Get(), &UGAAttributeComponent::ExecuteEffect, HandleIn);
FTimerManager& PeriodicTimer = HandleIn.GetEffectRef().Context.TargetComp->GetWorld()->GetTimerManager();
PeriodicTimer.SetTimer(HandleIn.GetEffectRef().PeriodTimerHandle, delPeriod,
HandleIn.GetEffectSpec()->Period, true, 0);
FTimerDelegate delDuration = FTimerDelegate::CreateUObject(HandleIn.GetContext().TargetComp.Get(), &UGAAttributeComponent::ExpireEffect, HandleIn);
FTimerManager& timerDuration = HandleIn.GetEffectRef().Context.TargetComp->GetWorld()->GetTimerManager();
}
示例2: InternalApplyDuration
void FGAGameEffectContainer::InternalApplyDuration(const FGAGameEffectHandle& 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,
HandleIn.GetEffectSpec()->Duration, false, HandleIn.GetEffectSpec()->Duration);
TArray<FGAEffectMod> Modifiers = HandleIn.GetEffectRef().GetAttributeModifiers();
EGAEffectStacking Stacking = HandleIn.GetEffectSpec()->EffectStacking;
InternalApplyEffectTags(HandleIn);
for (FGAEffectMod& Modifier : Modifiers)
{
if (Modifier.Attribute.IsValid())
{
UGAAttributesBase* attr = HandleIn.GetContextRef().GetTargetAttributes();
FGAAttributeBase* Attribute = attr->GetAttribute(Modifier.Attribute);
if (Attribute)
{
Attribute->AddBonus(FGAModifier(Modifier.AttributeMod, Modifier.Value), HandleIn, Stacking);
}
}
}
}
示例3: InternalApplyEffect
void FGAGameEffectContainer::InternalApplyEffect(const FGAGameEffectHandle& HandleIn)
{
UE_LOG(GameAttributesEffects, Log, TEXT("InternalApplyEffect"));
if (HandleIn.GetEffectSpec()->EffectType == EGAEffectType::Periodic)
{
FTimerDelegate delPeriod = FTimerDelegate::CreateUObject(HandleIn.GetContext().TargetComp.Get(), &UGAAttributeComponent::ExecuteEffect, HandleIn);
FTimerManager& PeriodicTimer = HandleIn.GetEffectRef().Context.TargetComp->GetWorld()->GetTimerManager();
PeriodicTimer.SetTimer(HandleIn.GetEffectRef().PeriodTimerHandle, delPeriod,
HandleIn.GetEffectSpec()->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,
HandleIn.GetEffectSpec()->Duration, false);
}
示例4: 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);
}
}
示例5: InternalExtendEffectDuration
void FGAGameEffectContainer::InternalExtendEffectDuration(const FGAGameEffectHandle& HandleIn, const FGAGameEffectHandle& ExtendingHandleIn)
{
if (ExtendingHandleIn.IsValid())
{
FTimerManager& DurationTimer = HandleIn.GetContextRef().TargetComp->GetWorld()->GetTimerManager();
float RemainingTime = DurationTimer.GetTimerRemaining(HandleIn.GetEffectRef().DurationTimerHandle);
float NewDuration = RemainingTime + ExtendingHandleIn.GetEffectSpec()->Duration;
DurationTimer.ClearTimer(HandleIn.GetEffectRef().DurationTimerHandle);
FTimerDelegate delDuration = FTimerDelegate::CreateUObject(HandleIn.GetContext().TargetComp.Get(), &UGAAttributeComponent::ExpireEffect, HandleIn);
DurationTimer.SetTimer(HandleIn.GetEffectRef().DurationTimerHandle, delDuration,
NewDuration, false);
}
else
{
InternalApplyEffect(HandleIn);
}
}
示例6: 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);
}
}