Appear.h
Source/MassBattle/Public/Fragments/Appear.h
概述 Overview
兵种出生(Appear)流程的 fragment 集合:配置 FAppear(出生延迟、动画/时长策略、溶解淡入、出生时生成 Actor/FX/音效)、运行时状态 FAppearing(出生过程计时与初始化/开始标志)与出生进行中标记 FAppearingTag。配置与运行时状态分离是 MassBattle 的标准模式。
Unit appearance (spawn) flow fragments: config FAppear (delay, anim/duration policy, dissolve fade-in, spawns of Actor/FX/sound at birth), runtime state FAppearing (appearance timers and initialized/started flags) and the in-appearance marker FAppearingTag. Separating config from runtime state is the standard MassBattle pattern.
FAppear USTRUCT
出生配置 fragment(FA_MassBattleBaseFragment 派生)。所有字段为策划在 EntityConfig 中可调参数,运行时不变。经 MASS_FRAGMENT_ACCEPT_NOT_TRIVIALLY_COPYABLE 声明为不可平凡拷贝(含 TArray 成员)。
Appearance config fragment (derived from FA_MassBattleBaseFragment). All fields are designer-tunable EntityConfig parameters, constant at runtime. Declared via MASS_FRAGMENT_ACCEPT_NOT_TRIVIALLY_COPYABLE as not-trivially-copyable (contains TArray members).
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
bEnable | bool | true | 是否启用兵种出生逻辑。Whether to enable the unit's initial appearance (spawn) logic. |
Delay | float | 0.f | 兵种出生前的延迟时间(秒)。Delay time (in seconds) before the unit's appearance starts. |
bCanPlayAnim | bool | true | 是否播放出生动画。Whether to play the unit's initial appearance animation. |
bAnimAsDuration | bool | false | 勾选后使用出生动画长度作为出生行为时长(动画长度定义在 Animation fragment 里)。仅当 bCanPlayAnim 为 true 时可编辑。When enabled, uses the appear anim length as appear behavior duration (defined in the Animation fragment). Editable only when bCanPlayAnim is true. |
Duration | float | 1.f | 出生行为总持续时间,会调整动画播放速度来匹配。仅当不播动画或未用动画时长时可编辑。Duration for the full appearance process; the anim playrate is adjusted to fit. Editable only when animation is off or anim-as-duration is off. |
bCanDissolveIn | bool | false | 是否启用淡入效果(溶解)。Whether to use a dissolve/fade-in effect during appearance. |
SpawnActor | TArray<FActorSpawnConfig> | 空 | 出生过程中生成 Actor 的配置列表。Configurations for spawning Actors during appearance. |
SpawnFx | TArray<FFxConfig> | 空 | 出生过程中生成视觉特效(FX)的配置列表。Configurations for spawning visual effects (FX) during appearance. |
PlaySound | TArray<FSoundConfig> | 空 | 出生过程中播放音效的配置列表。Configurations for playing sounds during appearance. |
FAppearing USTRUCT
出生运行时状态 fragment(FA_MassBattleBaseFragment 派生)。由出生相关处理器逐帧推进:Time 累计出生过程时间、AnimTime 累计动画时间、DissolveTime 累计消融时间;位域标志 bInitialized / bStarted 标记流程阶段。默认构造器将三个位域显式清零。
Appearance runtime state fragment (derived from FA_MassBattleBaseFragment), advanced per frame by the appearance processors: Time accumulates the appearance process, AnimTime the animation time, DissolveTime the dissolve time; the bitfield flags bInitialized / bStarted mark the flow stage. The default constructor zeroes all three bitfields explicitly.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
bInitialized | uint8 : 1 | 0 | 出生过程已初始化标志。Appearance process initialized flag. |
bStarted | uint8 : 1 | 0 | 出生过程已开始标志。Appearance process started flag. |
Time | float | 0.0f | 当前出生过程已持续时间(秒)。Current elapsed time of appearance (seconds). |
AnimTime | float | 0.0f | 当前动画时间。Current animation time. |
DissolveTime | float | 0.f | 当前消融效果时间。Current dissolve effect time. |
FAppearingTag Tag
出生流程进行中的 Tag(FA_MassBattleBaseTag 派生)。附着在正在执行出生流程的实体上,供查询筛选。
In-appearance Tag (derived from FA_MassBattleBaseTag). Attached to entities currently running the appearance flow, used for query filtering.
管线角色 Pipeline Role
FAppear / FAppearing 由行为/渲染/追踪处理器引用(grep 验证:MassBattleAgentBehaviorProcessor、MassBattleAgentRenderProcessor、MassBattleAgentTraceProcessor 及 MassBattleAgentSubsystem)。行为处理器推进出生流程计时并生成配置的 Actor/FX/音效,渲染处理器消费动画与消融状态。
FAppear / FAppearing are referenced by behavior / render / trace processors (verified by grep: MassBattleAgentBehaviorProcessor, MassBattleAgentRenderProcessor, MassBattleAgentTraceProcessor and MassBattleAgentSubsystem). The behavior processor advances the appearance timers and spawns the configured Actors/FX/sounds; the render processor consumes animation and dissolve state.