当前位置: 首页 > news >正文

02 GE-EffectSpec,EffectContext

1.FGameplayEffectSpec   效果Spec

创建:MakeOutGoingSpec=>EffectSpecHandle≈EffectSpec.

创建总结:Effect+Level+EffectContext=>EffectSpec(Handle)

数据:EffectSpec存有效果的等级,上下文,类。
还有很多其他东西:

----------------------------------------EffectSpec中的数据--------------------------------
//调用者通过标签设置给效果的float值。
TMap<FGameplayTag, float>	SetByCallerTagMagnitudes;//这个效果要给的GA,但是计划移植到GASpec,等下看看GASpec
TArray<FGameplayAbilitySpecDef> GrantedAbilitySpecs;//层数
int32 StackCount;//额外(资产)标签,被加入到CapturedSourceTags中
FGameplayTagContainer DynamicAssetTags;//额外要贴的标签
FGameplayTagContainer DynamicGrantedTags;//效果修改器计算后的值的列表,要填充
TArray<FModifierSpec> Modifiers;//创建效果时来源的标签
FTagContainerAggregator	CapturedSourceTags;//创建效果时目标的标签 - Aggregator中组合了各方的标签,哪些各方?
FTagContainerAggregator	CapturedTargetTags;//效果的周期,FGameplayEffectConstants::NO_PERIOD(无周期)
float Period;//效果的时长,FGameplayEffectConstants::INSTANT_APPLICATION(瞬时效果)/DURATION(不限时效果)
float Duration;//如果应用成功,还要应用的效果。(连锁反应?)
TArray< FGameplayEffectSpecHandle > TargetEffectSpecs;//捕获到的属性(源和目标都在这里面),用于自定义计算伤害,仅存在于服务器上。
FGameplayEffectAttributeCaptureSpecContainer CapturedRelevantAttributes;//效果修改到的属性(用于通知效果更改的吧。)
TArray<FGameplayEffectModifiedAttribute> ModifiedAttributes;//源和目标的标签。DynamicAssetTag也在源标签里。
FTagContainerAggregator	CapturedSourceTags;
FTagContainerAggregator	CapturedTargetTags;//被修改了的属性还有修改幅度
TArray<FGameplayEffectModifiedAttribute> ModifiedAttributes;

ModifierSpec里就存了一个修改器处理后的float,包裹一层只让朋友改EffectSpec和FActiveGameplayEffectsContainer

有些有用(懵逼)的函数:


//不知道什么意思
float CalculateModifiedDuration() const;//GESpec中有Capture概念,比较模糊。跟技能时长什么关系。什么OutGoingDurationCapture InComingDurationCapture的
void SetupAttributeCaptureDefinitions();//重新捕获源的标签。因为一开始就捕获了,可能过一段时间效果才生效,
在捕获一下看看能不能生效,要怎么生效什么的。
void RecaptureSourceActorTags();

从GE中取出修改器进行修改,然后填充到Modifier。FModifierSpec& ModSpec = Modifer[ModIdx]用的引用,Attemp....参数也是引用。所以是直接修改的Modifier中的元素。

获取上一个函数计算出来的列表中的某个元素,第二个参数是否考虑层数?

计算目标的的属性,当然还有Source版本,不过是Private

	virtual void GetOwnedGameplayTags
(OUT FGameplayTagContainer& ActorTagContainer,OUT FGameplayTagContainer& SpecTagContainer) const;

还有GetterSetter。特殊的是:

AllGrantedTag(GE的+DynamicGrantedTags),

BlockedAbilityTag(GE的),

AllAssetTag(GE的+DynamicAssetTags)

的Getter

2.FGameplayEffectContext  效果上下文

创建:MakeEffectContext() =>ContextHandle(这些什么什么Handle没什么实际卵用,但都有一些网络复制相关的内容。)约等于Context。

创建总结:设置了Instigator为ASC的OwnerActor,EffectCauser为ASC的AvatarActor,还设置了InstigatorASC。

EffectContext中的数据:

//应该指效果发生时的效果来源的世界坐标吧???
FVector	WorldOrigin;
//Actor啦
TArray<TWeakObjectPtr<AActor>> Actors;
//HitResult啦
TSharedPtr<FHitResult>	HitResult;
//效果来源
TWeakObjectPtr<UObject> SourceObject;
//技能等级,跟效果差不多吧。
int32 AbilityLevel;
//技能CDO
TWeakObjectPtr<UGameplayAbility> AbilityCDO;//来源的信息。
TWeakObjectPtr<AActor> Instigator;
TWeakObjectPtr<AActor> EffectCauser;
TWeakObjectPtr<UAbilitySystemComponent> InstigatorAbilitySystemComponent;

数据总结:存储了来源的ASC,OwnerActor,AvartarActor(SourceObject干嘛用的?

/** Object this effect was created from, can be an actor or static object. Useful to bind an effect to a gameplay object */

),来源技能的CDO和等级,还有来源的世界坐标啦,额外信息还有HitResult,Actors.
提供的函数就是一些GetterSetter没啥有用的。

---涉及Duration的函数都非常模糊,待我继续看源码理清楚这是个什么玩意。未完待续


http://www.mrgr.cn/news/98299.html

相关文章:

  • 在kotlin的安卓项目中使用dagger
  • 安卓开发提示Android Gradle plugin错误
  • 30天学Java第九天——线程
  • 设计模式 四、行为设计模式(2)
  • 某益网络面经总结
  • leetcode-单调栈26
  • 深入剖析 Axios 的 POST 请求:何时使用 qs 处理数据
  • 抗干扰CAN总线通信技术在分布式电力系统中的应用
  • ASP.NET Core 性能优化:客户端响应缓存
  • golang-context详解
  • 3 VS Code 深度配置与优化指南:settings.json 详解、快捷键大全、实用插件推荐及离线安装方法
  • 3DGS之光栅化
  • mongodb 4.0+多文档事务的实现原理
  • 网络基础-路由技术和交换技术以及其各个协议
  • ubuntu 20.04 安装源码编译 ros humble过程
  • 深入详解MYSQL的MVCC机制
  • CAP理论 与 BASE理论
  • python——正则表达式
  • C++17模板编程与if constexpr深度解析
  • C# net CMS相关开源软件 技术选型 可行性分析