本文整理汇总了C++中FGAGameEffectHandle::GetEffectSpec方法的典型用法代码示例。如果您正苦于以下问题:C++ FGAGameEffectHandle::GetEffectSpec方法的具体用法?C++ FGAGameEffectHandle::GetEffectSpec怎么用?C++ FGAGameEffectHandle::GetEffectSpec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FGAGameEffectHandle
的用法示例。
在下文中一共展示了FGAGameEffectHandle::GetEffectSpec方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InternalApplyEffectByAggregation
void FGAGameEffectContainer::InternalApplyEffectByAggregation(const FGAGameEffectHandle& HandleIn)
{
EGAEffectAggregation Aggregation = HandleIn.GetEffectRef().GameEffect->EffectAggregation;
switch (Aggregation)
{
case EGAEffectAggregation::AggregateByInstigator:
{
TMap<FGAGameEffectHandle, TSharedPtr<FGAGameEffect>>& EffectMap = InstigatorEffects.FindOrAdd(HandleIn.GetContextRef().Instigator.Get());
EffectMap.Add(HandleIn, HandleIn.GetEffectPtr());
TMap<FName, TSet<FGAGameEffectHandle>>& EffectByClass = InstigatorEffectHandles.FindOrAdd(HandleIn.GetContextRef().Instigator.Get());
TSet<FGAGameEffectHandle>& EffectSet = EffectByClass.FindOrAdd(HandleIn.GetEffectSpec()->GetFName());
EffectSet.Add(HandleIn);
break;
}
case EGAEffectAggregation::AggregateByTarget:
{
TSet<FGAGameEffectHandle>& Handles = TargetEffectByType.FindOrAdd(HandleIn.GetEffectSpec()->GetFName());
Handles.Add(HandleIn);
//TargetEffects.Add(HandleIn, HandleIn.GetEffectPtr());
break;
}
}
ActiveEffects.Add(HandleIn, HandleIn.GetEffectPtr());
}
示例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: InternalCheckPeriodicEffectStacking
void FGAGameEffectContainer::InternalCheckPeriodicEffectStacking(const FGAGameEffectHandle& HandleIn)
{
UGAGameEffectSpec* Spec = HandleIn.GetEffectSpec();
//sEGAEffectStacking Stacking = Spec->EffectStacking;
EGAEffectAggregation Aggregation = Spec->EffectAggregation;
EGAEffectStacking Stacking = HandleIn.GetEffectSpec()->EffectStacking;
UE_LOG(GameAttributes, Log, TEXT("Stacking Type: %s"), *EnumToString::GetStatckingAsString(Stacking));
FGAGameEffectHandle* Handle = nullptr;
switch (Aggregation)
{
case EGAEffectAggregation::AggregateByInstigator:
{
TMap<FName, TSet<FGAGameEffectHandle>>* EffectHandle = InstigatorEffectHandles.Find(HandleIn.GetContextRef().Instigator.Get());
TSet<FGAGameEffectHandle>* HandleSet = nullptr;
if (EffectHandle)
{
HandleSet = EffectHandle->Find(HandleIn.GetEffectSpec()->GetFName());
if (HandleSet)
{
Handle = HandleSet->Find(HandleIn);
}
}
}
case EGAEffectAggregation::AggregateByTarget:
{
TSet<FGAGameEffectHandle>* HandleSet = TargetEffectByType.Find(HandleIn.GetEffectSpec()->GetFName());
if (HandleSet)
{
Handle = HandleSet->Find(HandleIn);
}
break;
}
}
switch (Stacking)
{
case EGAEffectStacking::Add:
{
break;
}
case EGAEffectStacking::Duration:
{
break;
}
case EGAEffectStacking::Intensity:
{
break;
}
case EGAEffectStacking::Override:
{
break;
}
case EGAEffectStacking::StrongerOverride:
{
InternalApplyPeriodic(HandleIn);
break;
}
}
InternalApplyEffectByAggregation(HandleIn);
}
示例4: RemoveEffect
void FGAGameEffectContainer::RemoveEffect(FGAGameEffectHandle& HandleIn)
{
EGAEffectAggregation aggregatiopn = HandleIn.GetEffectRef().GameEffect->EffectAggregation;
UObject* Instigator = HandleIn.GetContextRef().Instigator.Get();
TSharedPtr<FGAGameEffect> effect = ActiveEffects.FindAndRemoveChecked(HandleIn);
if (effect.IsValid())
{
switch (aggregatiopn)
{
case EGAEffectAggregation::AggregateByInstigator:
{
TMap<FGAGameEffectHandle, TSharedPtr<FGAGameEffect>>* effects = InstigatorEffects.Find(Instigator);
TMap<FName, TSet<FGAGameEffectHandle>>* EffectByClass = InstigatorEffectHandles.Find(Instigator);
if (EffectByClass)
{
//Probabaly need another path for removing just single effect from stack.
EffectByClass->Remove(HandleIn.GetEffectSpec()->GetFName());
}
if (effects)
{
effects->FindAndRemoveChecked(HandleIn);
if (effects->Num() == 0)
{
InstigatorEffects.Remove(Instigator);
}
}
break;
}
case EGAEffectAggregation::AggregateByTarget:
{
//TargetEffects.FindAndRemoveChecked(HandleIn);
TSet<FGAGameEffectHandle>* Handles = TargetEffectByType.Find(HandleIn.GetEffectSpec()->GetFName());
//check aggregation type to know which effect to remove exactly ?
TargetEffectByType.Remove(HandleIn.GetEffectSpec()->GetFName());
break;
}
}
for (FGAGameEffectModifier& Modifier : effect->GameEffect->Modifiers)
{
if (Modifier.Attribute.IsValid())
{
FGAAttributeBase* Attribute = OwningComp->GetAttribute(Modifier.Attribute);
if (Attribute)
{
Attribute->RemoveBonus(HandleIn);
}
}
}
UE_LOG(GameAttributesEffects, Log, TEXT("FGAGameEffectContainer:: Removing Effect"))
effect.Reset();
}
}
示例5: 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();
float period = HandleIn.GetEffectSpec()->Period;
PeriodicTimer.SetTimer(HandleIn.GetEffectRef().PeriodTimerHandle, delPeriod,
period, true, 0);
FTimerDelegate delDuration = FTimerDelegate::CreateUObject(HandleIn.GetContext().TargetComp.Get(), &UGAAttributeComponent::ExpireEffect, HandleIn);
FTimerManager& timerDuration = HandleIn.GetEffectRef().Context.TargetComp->GetWorld()->GetTimerManager();
float Duration = HandleIn.GetEffectSpec()->Duration;
timerDuration.SetTimer(HandleIn.GetEffectRef().DurationTimerHandle, delDuration,
Duration, false, Duration);
InternalApplyEffectTags(HandleIn);
}
示例6: 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);
}
示例7: InternalApplyModifiers
void FGAGameEffectContainer::InternalApplyModifiers(const FGAGameEffectHandle& HandleIn)
{
TArray<FGAGameEffectModifier>& Modifiers = HandleIn.GetEffectSpec()->Modifiers;
EGAEffectStacking Stacking = HandleIn.GetEffectSpec()->EffectStacking;
for (FGAGameEffectModifier& Modifier : Modifiers)
{
if (Modifier.Attribute.IsValid())
{
UGAAttributesBase* attr = HandleIn.GetContextRef().GetTargetAttributes();
FGAAttributeBase* Attribute = attr->GetAttribute(Modifier.Attribute);
if (Attribute)
{
Attribute->AddBonus(FGAModifier(Modifier.ModType, Modifier.Value), HandleIn, Stacking);
}
}
}
}
示例8: RemoveEffect
void FGAGameEffectContainer::RemoveEffect(FGAGameEffectHandle& HandleIn)
{
EGAEffectAggregation aggregatiopn = HandleIn.GetEffectRef().GameEffect->EffectAggregation;
UObject* Instigator = HandleIn.GetContextRef().Instigator.Get();
TSharedPtr<FGAGameEffect> effect = ActiveEffects.FindAndRemoveChecked(HandleIn);
if (effect.IsValid())
{
switch (aggregatiopn)
{
case EGAEffectAggregation::AggregateByInstigator:
{
TMap<FGAGameEffectHandle, TSharedPtr<FGAGameEffect>>* effects = InstigatorEffects.Find(Instigator);
TMap<UClass*, FGAGameEffectHandle>* EffectByClass = InstigatorEffectHandles.Find(Instigator);
if (EffectByClass)
{
EffectByClass->Remove(HandleIn.GetEffectSpec()->StaticClass());
}
if (effects)
{
effects->FindAndRemoveChecked(HandleIn);
if (effects->Num() == 0)
{
InstigatorEffects.Remove(Instigator);
}
}
break;
}
case EGAEffectAggregation::AggregateByTarget:
{
TargetEffects.FindAndRemoveChecked(HandleIn);
break;
}
}
for (FGAGameEffectModifier& Modifier : effect->GameEffect->Modifiers)
{
if (Modifier.Attribute.IsValid())
{
FGAAttributeBase* Attribute = OwningComp->GetAttribute(Modifier.Attribute);
if (Attribute)
{
Attribute->RemoveBonus(HandleIn);
}
}
}
UE_LOG(GameAttributesEffects, Log, TEXT("FGAGameEffectContainer:: Removing Effect"))
effect.Reset();
}
}
示例9: 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);
}
}
示例10: InternalCheckEffectStacking
void FGAGameEffectContainer::InternalCheckEffectStacking(const FGAGameEffectHandle& HandleIn)
{
UGAGameEffectSpec* Spec = HandleIn.GetEffectSpec();
//sEGAEffectStacking Stacking = Spec->EffectStacking;
EGAEffectAggregation Aggregation = Spec->EffectAggregation;
EGAEffectStacking Stacking = HandleIn.GetEffectSpec()->EffectStacking;
UE_LOG(GameAttributes, Log, TEXT("Stacking Type: %s"), *EnumToString::GetStatckingAsString(Stacking));
switch (Aggregation)
{
case EGAEffectAggregation::AggregateByInstigator:
{
TMap<UClass*, FGAGameEffectHandle>* EffectHandle = InstigatorEffectHandles.Find(HandleIn.GetContextRef().Instigator.Get());
FGAGameEffectHandle* Handle = nullptr;
if(EffectHandle)
Handle = EffectHandle->Find(HandleIn.GetEffectSpec()->StaticClass());
switch (Stacking)
{
case EGAEffectStacking::Add:
{
InternalApplyEffect(HandleIn);
break;
}
case EGAEffectStacking::Duration:
{
if (Handle)
{
InternalExtendEffectDuration(*Handle, HandleIn);
}
else
{
FGAGameEffectHandle InvalidHandle;
InternalExtendEffectDuration(HandleIn, InvalidHandle);
}
break;
}
case EGAEffectStacking::Intensity:
{
break;
}
case EGAEffectStacking::Override:
{
if (Handle)
{
RemoveEffect(*Handle);
}
InternalApplyEffect(HandleIn);
break;
}
case EGAEffectStacking::StrongerOverride:
{
if (Handle)
{
RemoveEffect(*Handle);
}
InternalApplyEffect(HandleIn);
break;
}
}
break;
}
case EGAEffectAggregation::AggregateByTarget:
{
break;
}
}
InternalApplyEffectByAggregation(HandleIn);
}