HealthBar.h
Source/MassBattle/Public/Fragments/HealthBar.h
概述 Overview
血条显示配置与运行时状态 fragment。前八项为策划可调的可见性/插值规则(显示开关、选中强制显示、满血/空血隐藏、相机距离剔除、自动隐藏);后三项(TargetRatio / CurrentRatio / Opacity)为无 Tooltip 的运行时状态,由渲染处理器逐帧推进(目标比例 → 插值当前比例 → 透明度)。
Health bar visibility config and runtime state fragment. The first eight fields are designer-tunable visibility/interpolation rules (show toggle, force-show on select, hide on full/empty health, camera-distance culling, auto-hide); the last three (TargetRatio / CurrentRatio / Opacity) are runtime state without tooltips, advanced per frame by the render processor (target ratio → interpolated current ratio → opacity).
FHealthBar USTRUCT
派生自 FA_MassBattleBaseFragment。
Derived from FA_MassBattleBaseFragment.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
bShowHealthBar | bool | true | 是否显示血条。Whether to show the health bar. |
bShowOnSelected | bool | true | Agent 被选中时强制显示血条(最高优先级,覆盖其它所有可见性规则)。Force-show the health bar when the agent is selected (highest priority, overrides all other visibility rules). |
HideOnFullHealth | bool | true | 血量满时是否隐藏血条。Whether to hide the health bar when health is full. |
HideOnEmptyHealth | bool | true | 血量为空时是否隐藏血条。Whether to hide the health bar when health is empty. |
UseInterpolation | bool | true | 是否使用插值平滑血条变化。Whether to interpolate to smooth health bar changes. |
InterpSpeed | float | 10.f | 血条插值变化的速度。Speed of the health bar interpolation. |
CullDistance | float | 0.f | 超过此相机距离隐藏血条(0 = 不剔除)。相机各端不同,故为渲染层的按端本地决策——只改发往 Niagara 的值,绝不写入参与同步的 Opacity 字段。Hide the health bar beyond this camera distance (0 = never cull). The camera differs per peer, so this is a render-layer decision per peer — only the value sent to Niagara changes; the synced Opacity field is never written. |
HideAfterSeconds | float | 0.f | 经过此秒数后自动隐藏血条(0 = 永不自动隐藏)。Auto-hide the health bar after this many seconds (0 = never auto-hide). |
TargetRatio | float | 1.f | 运行时状态:目标比例(当前/最大生命值),由伤害/恢复逻辑写入。Runtime state: target ratio (Current/Maximum health), written by damage/heal logic. |
CurrentRatio | float | 1.f | 运行时状态:插值后的当前显示比例,由渲染处理器逐帧逼近 TargetRatio。Runtime state: interpolated display ratio, advanced each frame toward TargetRatio by the render processor. |
Opacity | float | 0.f | 运行时状态:当前透明度,由可见性规则与自动隐藏计时共同驱动。Runtime state: current opacity, driven by visibility rules and the auto-hide timer. |
管线角色 Pipeline Role
grep 验证:FHealthBar 被 MassBattleAgentRenderProcessor(逐帧推进比例插值与透明度)、MassBattleAgentReactionProcessor 与 MassBattleAgentSubsystem(初始化/复位时写入)引用。
Verified by grep: FHealthBar is referenced by MassBattleAgentRenderProcessor (per-frame ratio interpolation and opacity), MassBattleAgentReactionProcessor and MassBattleAgentSubsystem (written at init/reset).