NotifyShared.h
Source/MassBattle/Public/Fragments/NotifyShared.h
概述Overview
notify 表:一行就是「本行的触发到来时,做这件事」。触发有两种来源——已烘片段上的 notify 按名字命中(Anim),或 agent 事件族加阶段掩码命中(Event)。这张表以 Notify Shared 条目出现在 Agent 配置里,是每模板一份的共享片段;命中时才读,不是逐帧扫描。它刻意没有伤害类:命中伤害唯一归属是 Attack.h 的 TimeOfHit。
The notify table: one row means "when this row's trigger fires, do this". A row is triggered one of two ways — by a baked clip notify whose name matches (Anim), or by an agent event family plus a stage mask (Event). The table appears as the Notify Shared entry on the agent config and is a per-template shared fragment; it is read when a trigger fires, not scanned per frame. It deliberately has no damage kind: hit damage has exactly one owner, TimeOfHit on Attack.h.
ENotifyAction UENUM
一行触发时做什么。每个生成类只读自己那份载荷字段。
What a row does when it fires. Each spawn kind reads only its own payload field.
| 值Value | 说明Description |
|---|---|
SpawnActor | 生成 Actor 字段描述的 Actor。Spawn the actor described by the Actor field. |
SpawnFx | 生成 Fx 字段描述的特效。Spawn the effect described by the Fx field. |
SpawnSound | 播放 Sound 字段描述的音效。Play the sound described by the Sound field. |
SpawnProjectile | 生成 Projectile 字段描述的抛射物。只在攻击片段的 notify 上生效。Spawn the projectile described by the Projectile field.Attack clip notifies only. |
SpawnLoot | 生成 Loot 字段描述的战利品。Spawn the loot described by the Loot field. |
Event | 在 agent 接口上触发 OnAnimNotify——永远可用,不需要任何资产。Raise OnAnimNotify on the agent interface — always works, needs no asset. |
Behavior | 请求把行为切换到 Behavior 字段指定的行为,由行为系统在下一 tick 消费。Request a switch to the behavior named by the Behavior field, consumed by the behavior system on the next tick. |
Reaction | 触发本单位的反应通道之一,通道由 Reaction 字段选择。Trigger one of the agent's reaction channels, chosen by the Reaction field. |
Ragdoll | 为本单位的尸体启动布娃娃模拟;只在单位处于死亡过程中时生效。Start the ragdoll simulation for this agent's corpse;only takes effect while the agent is dying. |
ENotifySource UENUM
真正触发一行的来源。两种来源互不读取对方的字段,一行因此绝不会同时响应两种触发。
What actually fires a row. The two sources never read each other's fields, so a row never answers two triggers at once.
| 值Value | 说明Description |
|---|---|
Anim | 由播放头越过的已烘片段 notify 触发,要求其名字等于 Name。Fires from a baked clip notify crossed by the playhead, whose name equals Name. |
Event | 由 agent 事件触发,要求事件族等于 EventFamily、且事件的阶段是 EventStageMask 中置位的一位(掩码 0 = 任意阶段)。Fires from an agent event whose family equals EventFamily and whose stage is a set bit in EventStageMask (mask 0 = any stage). |
EReactionTrigger UENUM
Reaction 动作驱动哪一条反应通道。只覆盖这四条已经有运行期路径的通道。
Which reaction channel a Reaction action drives. Only these four channels have a runtime path.
| 值Value | 说明Description |
|---|---|
Select | 设置选中状态并生成其端侧视觉,等同 SelectAgents。Set the select state and spawn its local visuals, exactly like SelectAgents. |
Deselect | 清除两种选中状态并销毁其端侧视觉,等同 DeselectAgents。Clear both select states and destroy their local visuals, exactly like DeselectAgents. |
Hit | 重播受击反应(辉光 / 挤压 / 受击动画),不造成伤害。Replay the hit reaction (glow / jiggle / hit animation)without dealing damage. |
Death | 启动正常死亡序列:生命值置 0,死亡反应照常执行。Start the normal death sequence: health is set to 0 and the death reaction runs as usual. |
ENotifyEventFamily UENUM
Event 行可以响应的事件族。事件族的阶段按表中第二个列出的枚举解释;标为「任意」的三族没有阶段词表,阶段恒为任意。
The event families an Event row can answer. A family's stages are read with the enum in the second column; the three families marked "any" have no stage vocabulary, so their stage is always any.
| 值Value | 阶段枚举Stage Enum | 说明Description |
|---|---|---|
Appear | EAppearEventState | 出现事件。Appear events. |
Trace | ETraceEventState | 索敌事件。Trace events. |
Move | EMoveEventState | 移动事件。Move events. |
Sleep | ESleepEventState | 休眠事件。Sleep events. |
Patrol | EPatrolEventState | 巡逻事件。Patrol events. |
Chase | EChaseEventState | 追逐事件。Chase events. |
Reinforce | EReinforceEventState | 支援事件。Reinforce events. |
Attack | EAttackEventState | 攻击事件。Attack events. |
Hit | EHitEventState | 受击事件。Hit events. |
Death | EDeathEventState | 死亡事件。Death events. |
Pool | EPoolEventState | 对象池事件。Pool events. |
Statistics | 任意 Anyany | 统计事件;没有阶段词表。Statistics events; no stage vocabulary. |
AnimStateChange | 任意 Anyany | 动画状态变更事件;没有阶段词表。Anim state change events; no stage vocabulary. |
MontageEnded | 任意 Anyany | 蒙太奇结束事件;没有阶段词表。Montage ended events; no stage vocabulary. |
Select | ESelectEventState | 选中事件。Select events. |
FMassBattleNotifyAction USTRUCT
表里的一行:触发来源、该来源要匹配的条件、要执行的动作,以及只属于该动作的那份载荷。
One row of the table: where it is triggered from, the condition that source must match, the action to perform, and the payload that belongs to that action only.
成员变量Members
| 名称Name | 类型Type | 默认值 | 说明Description |
|---|---|---|---|
Source | ENotifySource | Anim | 本行由何处触发。来源决定下面哪些字段被读取。Where this row is triggered from. The source decides which fields below are read. |
Name | FName | 空empty | 本行响应的片段 notify 名字——就是作者在 Persona 里那条片段 notify 上写的名字。只在 Source = Anim 时显示与读取。The clip notify name this row answers — exactly the name typed on the clip's notify in Persona. Shown and read only when Source = Anim. |
EventFamily | ENotifyEventFamily | Attack | 本行响应的 agent 事件族。EventStageMask 的各位按该族的阶段枚举解释。只在 Source = Event 时显示与读取。The agent event family this row answers. The bits of EventStageMask are read with that family's stage enum. Shown and read only when Source = Event. |
EventStageMask | int32 | 0 | 本行响应的阶段,按位掩码给出:第 i 位 = 该族阶段枚举的第 i 个阶段。0 = 任意阶段。可同时勾选多位(例如死亡同时响应「生命耗尽」与「自杀攻击」)。只在 Source = Event 时显示与读取。Stages this row answers, as a bitmask: bit i = stage i of the family's stage enum.0 = any stage. Several bits may be selected (death can answer both out-of-health and suicide-attack). Shown and read only when Source = Event. |
Action | ENotifyAction | Event | 该行触发时做什么。下面每个载荷字段只在本项选中对应动作时显示与读取。What this action does when the row fires. Each payload field below is shown and read only for its own action. |
Projectile | FProjectileConfig | — | 要生成的抛射物。仅 Action = SpawnProjectile。Projectile to spawn. Only for Action = SpawnProjectile. |
Fx | FFxConfig_Attack | — | 要生成的特效。仅 Action = SpawnFx。Effect to spawn. Only for Action = SpawnFx. |
Actor | FActorSpawnConfig_Attack | — | 要生成的 Actor。仅 Action = SpawnActor。Actor to spawn. Only for Action = SpawnActor. |
Sound | FSoundConfig_Attack | — | 要播放的音效。仅 Action = SpawnSound。Sound to play. Only for Action = SpawnSound. |
Loot | FLootConfig | — | 要生成的战利品。仅 Action = SpawnLoot。Loot to spawn. Only for Action = SpawnLoot. |
Behavior | EBehaviorChoice | Idle | 要切换到的行为。仅 Action = Behavior。Behavior to switch to. Only for Action = Behavior. |
Reaction | EReactionTrigger | Hit | 本动作驱动的反应通道。仅 Action = Reaction。Which reaction channel this action drives. Only for Action = Reaction. |
边界与注意Caveats
这里没有伤害动作,这是刻意的。命中伤害只有一个归属:攻击配置里的 TimeOfHit,它恒为标量时钟。片段 notify 只执行自己的动作,绝不改变命中时刻、也不门控命中——在这里再开一条伤害路径,会让同一次挥击按谁先触发而命中两次。要伤害,请调攻击配置。
There is no damage action here, deliberately. Hit damage has one owner: TimeOfHit on the attack config, always driven by the scalar clock. Clip notifies only run their own actions and never move or gate the hit — a second damage path here would let one swing land two hits depending on which system fired first. For damage, use the attack config.
Event 行不看事件开关。agent 无论 FAgentEvent 上的各事件开关如何都会记录全部事件族;那些开关只门控蓝图 agent 接口的事件。因此关掉某个事件开关不会让本表对应的 Event 行停止触发。
Event rows ignore the event switches. The agent records every event family regardless of the per-event switches on FAgentEvent; those switches gate only the Blueprint agent-interface event. Turning an event switch off therefore does not stop the matching Event rows in this table.
默认动作不是生成类。新加一行的动作默认是 Event——在 agent 接口上触发 OnAnimNotify,不会生成任何资产;要生成特效 / 音效 / 抛射物,把动作改成对应的生成类并填那份载荷。
The default action is not a spawn kind. A new row's action defaults to Event — raise OnAnimNotify on the agent interface, spawning nothing. To spawn an effect, sound or projectile, switch the action to that spawn kind and fill its payload.
一个阶段掩码可以同时命中多位。0 表示不过滤(未勾选任何项时写出的也是 0);勾选多项则同时响应同一族的多个阶段,例如攻击同时响应「开始」与「命中」。
A stage mask may match several stages at once.0 means no filter (which is also what an empty selection writes); selecting several items answers several stages of one family — for example an attack answering both begin and hit.
Anim 行不需要再选片段。它响应的片段由那条片段 notify 自身决定;一行只响应一种来源,Name 与 EventFamily / EventStageMask 不会同时生效。
An Anim row needs no clip choice. Its clip is implied by the clip notify it answers, and a row answers only one source — Name and EventFamily / EventStageMask never apply together.
抛射物只从攻击片段发出。SpawnProjectile 只在攻击片段的 notify 上生效;在其它片段的 notify 上这一行什么也不生成。布娃娃动作则只在单位处于死亡过程中生效。
Projectiles only fire from attack clips.SpawnProjectile takes effect only on attack clip notifies; on any other clip's notify the row spawns nothing. The ragdoll action likewise only takes effect while the unit is dying.
开关也属于表的身份。行相同、开关相反的两份配置仍是不同的共享片段,否则一份资产的静默会悄悄变成另一份的行为。是否发出蓝图事件仍由 FAgentEvent 逐原型决定,不属于这张表的身份。
The switch is part of the table's identity. Two configs with identical rows but opposite switches stay different shared fragments; otherwise one asset's silence would silently become the other's behavior. Whether a Blueprint event is emitted is still a per-archetype FAgentEvent gate and is not part of this table's identity.