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

02核心-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/98240.html

相关文章:

  • Excel表格文件分组归并——通过sql
  • Sklearn入门之datasets的基本用法
  • Android Studio 在 Windows 上的完整安装与使用指南
  • 八大定位UI
  • 从宇树摇操avp_teleoperate到unitree_IL_lerobot:如何基于宇树人形进行二次开发(含Open-TeleVision源码解析)
  • 【HD-RK3576-PI】系统更新与恢复
  • CSI-PVController-claimWorker
  • Linux上位机开发实践(OpenCV算法硬件加速)
  • 【redis进阶三】分布式系统之主从复制结构(1)
  • 【复旦微FM33 MCU 底层开发指南】高级定时器ATIM
  • NoSQL入门指南:Redis与MongoDB的Java实战
  • 2025蓝桥杯python A组题解
  • 数据库事务管理:ACID特性与隔离级别的深度解读
  • QScrCpy源码解析(4)获取手机端数据知识补充
  • RVOS-4.实现上下文切换和协作式多任务
  • 大模型到底是怎么产生的?一文了解大模型诞生全过程
  • KTransformers安装笔记 利用docker安装KTransformers
  • 句句翻译。
  • mysql安装-MySQL MGR(Group Replication)+ ProxySQL 架构
  • 【初入职场】文件地狱大逃亡:运维侠Python自动化逆袭之路4整理术(日省3h摸鱼真经)