Mass Battle Frameworkv1.20.0

Hit.h

USTRUCT ×2

Source/MassBattle/Public/Fragments/Hit.h

概述Overview

受击反馈 fragment 对:配置 FHit(发光、受击动画、挤压、以及受击时生成的 Actor / 特效 / 音效列表)与运行时状态 FBeingHit(各类反馈的累计时间与冷却计时器 + 复位方法)。受击动画仅在 Agent 静止且播放 Idle 动画时生效。

Hit-reaction fragment pair: config FHit (glow, hit animation, jiggle, plus actor/FX/sound spawn lists on hit) and runtime state FBeingHit (accumulated timers and cooldown timers for each feedback + reset methods). The hit animation only takes effect when the agent is stationary and playing the idle animation.

FHit USTRUCT

受击配置 fragment,派生自 FA_MassBattleBaseFragment,经 MASS_FRAGMENT_ACCEPT_NOT_TRIVIALLY_COPYABLE 声明为不可平凡拷贝(含 TArray 成员)。所有字段为策划可调参数。

Hit config fragment derived from FA_MassBattleBaseFragment, declared not-trivially-copyable via MASS_FRAGMENT_ACCEPT_NOT_TRIVIALLY_COPYABLE (contains TArray members). All fields are designer-tunable.

成员变量Members

名称Name类型Type默认值说明Description
bCanGlowbooltrue是否启用被击中时的发光效果。Whether to enable the glow effect when hit.
GlowCooldownfloat0.f击打发光效果冷却时间(秒)。仅 bCanGlow 为 true 时可编辑。Cooldown between hit glow effects (seconds). Editable only when bCanGlow is true.
bPlayAnimbooltrue播放受击动画,只会在 Agent 静止且播放 Idle 动画时生效。Play the hit animation; effective only when the agent is stationary and playing the idle animation.
bAnimAsDurationboolfalse勾选后使用受击动画长度作为受击反馈时长(动画长度定义在 Animation fragment 里)。仅 bPlayAnim 为 true 时可编辑。When enabled, uses the hit anim length as the hit-reaction duration (defined in the Animation fragment). Editable only when bPlayAnim is true.
AnimLengthfloat1受击动画时长。仅播放动画且未用动画时长时可编辑。Hit animation duration. Editable only when anim is on and anim-as-duration is off.
AnimCooldownfloat0.f击打动画冷却时间(秒)。仅 bPlayAnim 为 true 时可编辑。Cooldown between hit animations (seconds). Editable only when bPlayAnim is true.
JiggleStrfloat0.f被击中时的挤压/拉伸强度。Jiggle (squash/stretch) strength when hit.
SpawnActorTArray<FActorSpawnConfig>空empty受击时生成的 Actor 配置列表。Actors to spawn on hit.
SpawnFxTArray<FFxConfig>空empty受击时生成的特效配置列表。FX to spawn on hit.
PlaySoundTArray<FSoundConfig>空empty受击时播放的声音配置列表。Sounds to play on hit.

FBeingHit USTRUCT

受击运行时状态 fragment,派生自 FA_MassBattleBaseFragment。六个计时器由受击反馈处理器逐帧推进,配合四个 FORCEINLINE 复位方法。

Hit runtime state fragment derived from FA_MassBattleBaseFragment. Six timers advanced per frame by the hit-reaction processor, paired with four FORCEINLINE reset methods.

成员变量Members

名称Name类型Type默认值说明Description
GlowTimefloat0.0f当前发光时间。Current glow time.
JiggleTimefloat0.0f当前挤压时间。Current jiggle time.
AnimTimefloat0.0f当前动画时间。Current animation time.
HealthBarTimerfloat0.0f血条自动隐藏计时器。Health bar auto-hide timer.
GlowCooldownTimerfloat0.f发光效果冷却计时器。Cooldown timer for the glow effect.
AnimCooldownTimerfloat0.f击打动画冷却计时器。Cooldown timer for the hit animation.

方法Methods

ResetGlow FORCEINLINE void

将 GlowTime 复位为 0。

Resets GlowTime to 0.

Input

无参数。

No parameters.

Output

无返回值。副作用:GlowTime 清零。

No return value. Side effect: GlowTime zeroed.

ResetJiggle FORCEINLINE void

将 JiggleTime 复位为 0。

Resets JiggleTime to 0.

Input

无参数。

No parameters.

Output

无返回值。副作用:JiggleTime 清零。

No return value. Side effect: JiggleTime zeroed.

ResetAnim FORCEINLINE void

将 AnimTime 复位为 0。

Resets AnimTime to 0.

Input

无参数。

No parameters.

Output

无返回值。副作用:AnimTime 清零。

No return value. Side effect: AnimTime zeroed.

ResetHealthBarTimer FORCEINLINE void

将 HealthBarTimer 复位为 0。

Resets HealthBarTimer to 0.

Input

无参数。

No parameters.

Output

无返回值。副作用:HealthBarTimer 清零。

No return value. Side effect: HealthBarTimer zeroed.

管线角色Pipeline Role

grep 验证:FBeingHit / FHit 被 MassBattleAgentReactionProcessor(伤害命中时写状态、推进计时器)、MassBattleAgentSubsystem(实体构建/复用时初始化)与 MassBattleSubsystem 引用。受击反馈生成内容(SpawnActor/SpawnFx/PlaySound)由反应处理器消费。

Verified by grep: FBeingHit / FHit are referenced by MassBattleAgentReactionProcessor (writes state and advances timers on damage hit), MassBattleAgentSubsystem (initialized at entity build/reuse) and MassBattleSubsystem. The hit spawn content (SpawnActor/SpawnFx/PlaySound) is consumed by the reaction processor.