ProjectileHostConfig.h
Source/MassBattle/Public/Fragments/ProjectileHostConfig.h
概述 Overview
投射物宿主配置体系,按「配置/运行时」成对组织:通用参数(FProjectileParams / FProjectileParamsRT)、四种移动模型——静态(FProjectileMove_Static)、插值(FProjectileMove_Interped / FProjectileMoving_Interped)、弹道(FProjectileMove_Ballistic / FProjectileMoving_Ballistic)、追踪(FProjectileMove_Tracking / FProjectileMoving_Tracking)、每模型乘数(FProjectileMultipliers 聚合四子类)、生成配置(FProjectileConfig → 运行时 FProjectileConfig_Final)、生成内容(FProjectileSpawnContent / FProjectileSpawn)、以及确定性排序命令 FProjectileOptCommand。另有两个枚举:EProjectileSolveMode(弹道求解模式)与 EDamageRepetitionMode(伤害重复模式)。
Projectile host config system organized as config/runtime pairs: common params (FProjectileParams / FProjectileParamsRT), four movement models — static (FProjectileMove_Static), interped (FProjectileMove_Interped / FProjectileMoving_Interped), ballistic (FProjectileMove_Ballistic / FProjectileMoving_Ballistic) and tracking (FProjectileMove_Tracking / FProjectileMoving_Tracking), per-model multipliers (FProjectileMultipliers aggregating four sub-sets), spawn config (FProjectileConfig → runtime FProjectileConfig_Final), spawn content (FProjectileSpawnContent / FProjectileSpawn) and the deterministic-sort command FProjectileOptCommand. Two enums: EProjectileSolveMode (ballistic solve mode) and EDamageRepetitionMode (damage repetition mode).
EProjectileSolveMode UENUM
弹道轨迹求解模式,由 FProjectileMove_Ballistic::SolveMode 使用。
Ballistic trajectory solve mode, used by FProjectileMove_Ballistic::SolveMode.
| 值 Value | 说明 Description |
|---|---|
FromPitch | 根据俯仰角求解(使用 Pitch 字段)。Solve from the pitch angle (uses the Pitch field). |
FromSpeed | 根据初速度求解(使用 Speed 字段)。Solve from the initial speed (uses the Speed field). |
EDamageRepetitionMode UENUM
伤害重复模式,由 FProjectileParams::DamageRepetitionMode 使用。
Damage repetition mode, used by FProjectileParams::DamageRepetitionMode.
| 值 Value | 说明 Description |
|---|---|
Periodic | 基于冷却时间周期性伤害重叠单位。Hurt overlapping agents periodically based on cooldown. |
OncePerOverlap | 每次重叠造成一次伤害(离开后重置)。Hurt once per overlap (reset on exit). |
OnceForever | 绝对只造成一次伤害。Hurt absolutely once. |
None | 无伤害。No damage. |
FProjectileBornTag USTRUCT
投射物出生标记 Tag,派生自 FA_MassBattleBaseTag,无数据成员。grep 验证:Private/ 下无 .cpp 引用——已由 FProjectileParamsRT::bBornFired 逐实体锁存器取代(见该字段说明)。
Projectile birth marker tag derived from FA_MassBattleBaseTag, no data members. Verified by grep: no .cpp under Private/ references it — superseded by the per-entity FProjectileParamsRT::bBornFired latch (see that field).
FProjectileTriggerConditions USTRUCT
投射物触发条件集合(普通 USTRUCT,非 fragment),五个布尔条件。
Projectile trigger condition set (plain USTRUCT, not a fragment) of five boolean conditions.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
bOnArrival | bool | false | 抵达目标/终点时触发。Trigger on arrival at the target/destination. |
bOnNoLifeSpan | bool | false | 寿命耗尽时触发。Trigger when the lifespan runs out. |
bOnNoHealth | bool | false | 血量耗尽时触发。Trigger when health runs out. |
bOnHitObstacle | bool | false | 撞击障碍物(环境)时触发。Trigger when hitting an obstacle (environment). |
bOnHitEntity | bool | false | 撞击实体(单位)时触发。Trigger when hitting an entity (agent). |
FProjectileParams USTRUCT
投射物通用配置 fragment,派生自 FA_MassBattleBaseFragment,声明为不可平凡拷贝(含 FMassBattleQuery)。构造函数预设默认触发条件:RemovalConditions 默认触发抵达/寿命尽/血尽/撞障碍,ApplyDmgConditions 默认触发撞实体。
Projectile common config fragment derived from FA_MassBattleBaseFragment, declared not-trivially-copyable (contains FMassBattleQuery). The ctor presets default trigger conditions: RemovalConditions triggers on arrival/lifespan/health/obstacle-hit, ApplyDmgConditions on entity-hit.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
Radius | float | 100 | 碰撞检测半径。Collision detection radius. |
LifeSpan | float | 5 | 剩余寿命(秒)。Remaining lifespan (seconds). |
Health | int32 | 1 | 血量,每发生一次碰撞血量 -1,归零后不再造成伤害。Health; each collision reduces it by 1; no damage once it reaches zero. |
DmgCoolDown | float | 0.0f | 造成伤害的最小时间间隔(秒)。Minimum time interval between damage instances (seconds). |
DamageRepetitionMode | EDamageRepetitionMode | OncePerOverlap | 伤害重复模式(见枚举)。Damage repetition mode (see the enum). |
Query | FMassBattleQuery | — | 碰撞条件查询(可命中哪些实体,定义于 MassBattleStructs.h)。Collision condition query (which entities can be hit; defined in MassBattleStructs.h). |
bDrawDebugShape | bool | false | 绘制调试图形。Draw debug shapes. |
bRotationFollowVelocity | bool | true | 朝向运动方向。Rotation follows the velocity direction. |
RotationInterpSpeed | float | 20.f | 朝向速度方向的旋转插值速度(QInterpTo 速率)。Rotation interpolation speed toward the velocity direction (QInterpTo rate). |
InterpParams | FInterpParams | — | 附着 FX 平滑插值参数。Interpolation parameters for attached FX smoothing. |
bTraceOnlyOnArrival | bool | false | 仅在抵达目标点后进行一次碰撞检测,可以节约性能。Only perform collision detection once upon arrival at the target point; saves performance. |
bCheckObstacle | bool | false | 能否与环境碰撞。Whether the projectile can collide with the environment. |
CheckRadius | float | 0.f | 障碍物检测扫掠半径,0 = 射线检测。Obstacle-check sweep radius; 0 = line trace. |
TargetLocationSpreadXY | float | 0 | 目标位置水平散布半径。Target location horizontal spread radius. |
TargetLocationSpreadZ | float | 0 | 目标位置垂直散布半径。Target location vertical spread radius. |
ApplyDmgConditions | FProjectileTriggerConditions | — | 造成伤害/减益的条件(默认仅撞实体触发)。Conditions to apply damage/debuffs (defaults to entity-hit only). |
RemovalConditions | FProjectileTriggerConditions | — | 投射物销毁条件(默认抵达/寿命尽/血尽/撞障碍触发)。Conditions to destroy the projectile (defaults to arrival/lifespan/health/obstacle-hit). |
FProjectileParamsRT USTRUCT
投射物通用运行时状态 fragment,派生自 FA_MassBattleBaseFragment,声明为不可平凡拷贝。携带伤害归属、忽略列表、冷却倒计时与池化字段。bBornFired 为逐实体 OnBirth 锁存器:旧设计用一次性 archetype Tag(FProjectileBornTag)导致池复用后静默跳过 OnBirth;改用普通 bool(非位域——位域 pad 位不确定会导致 hash 折叠假失步,且非 UPROPERTY 位域无法被 FindFProperty 找到)。
Projectile common runtime state fragment derived from FA_MassBattleBaseFragment, declared not-trivially-copyable. Carries damage instigator, ignore list, cooldown countdown and pool fields. bBornFired is a per-entity OnBirth latch: the old one-way archetype tag (FProjectileBornTag) made pool-reused projectiles silently skip OnBirth; a plain bool is used instead (not a bitfield — pad bits are indeterminate, causing false desync in hash folding, and non-UPROPERTY bitfields can't be found by FindFProperty).
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
Instigator | FEntityHandle | 无效句柄 | 伤害归属者。Damage instigator. |
IgnoreEntities | FEntityArray | — | 忽略列表(定义于 MassBattleStructs.h)。Ignore list (defined in MassBattleStructs.h). |
DmgCoolDownTimeLeft | float | 0.0f | 距离下一次造成伤害的剩余时间。Time remaining until the next damage instance. |
PoolDataAsset | TObjectPtr<UMassBattleProjectileConfigDataAsset> | nullptr | 标识该投射物回收进哪个按原型划分的池。激活时设置、销毁时读取。新增 UPROPERTY 字段会改变内存布局但不改变 archetype(同 fragment 类型),池条目不迁移。Identifies which per-archetype pool this projectile recycles into. Set on activation, read on despawn. Adding a UPROPERTY here changes memory layout but NOT the archetype (same fragment type), so pool entries don't migrate. |
bBornFired | bool | false | 逐实体 OnBirth 锁存器,保证池复用安全。在 ProcessHostOpsQueues 的投射物排空中于激活时复位为 false。快照注册表字段。Per-entity OnBirth latch for pool-reuse correctness. Reset to false at activation in ProcessHostOpsQueues' projectile drain. Snapshot registry field. |
PoolCountdown | float | 0.f | 逐实体池闲置倒计时。池中休眠时 TickEntityPoolCooldowns 每 MassBattle tick 递减;归零即销毁(排空出池——无保留下限,桶可缩至 0)。每次入池(回收)复位为统一的 PoolIdleLifeSpan,复用后再回收会从满计时重启。Per-entity pool idle countdown. While pooled, TickEntityPoolCooldowns decrements it each MassBattle tick; once it reaches 0 the entity is destroyed (drained from the pool — no minimum floor, the bucket can shrink to 0). Reset to the unified PoolIdleLifeSpan on every push (recycle) so reuse-then-rerecycle restarts the timer from full. |
FProjectileMove_Static USTRUCT
静态投射物的移动配置 fragment,派生自 FA_MassBattleBaseFragment。当前为空结构——静态投射物无需移动参数。
Static projectile movement config fragment derived from FA_MassBattleBaseFragment. Currently empty — static projectiles need no movement parameters.
FProjectileMove_Interped USTRUCT
插值投射物的移动配置 fragment,派生自 FA_MassBattleBaseFragment,声明为不可平凡拷贝(含曲线)。构造函数用「0→1 三段零点曲线」初始化 X/Y/Z 偏移曲线(三次插值、自动切线)。
Interped projectile movement config fragment derived from FA_MassBattleBaseFragment, declared not-trivially-copyable (contains curves). The ctor initializes X/Y/Z offset curves with 0→1 zero curves (cubic interp, auto tangents).
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
Speed | float | 2000 | 速度。Speed. |
XOffset | FRuntimeFloatCurve | 0→1 零点曲线 | 前后偏移曲线。Forward/backward offset curve. |
XOffsetRangeMap | FVector4f | (0,1,10000,1) | 前后偏移-距离映射乘数(DistMin, MultAtMin, DistMax, MultAtMax)。Forward/backward offset distance mapping multiplier (DistMin, MultAtMin, DistMax, MultAtMax). |
YOffset | FRuntimeFloatCurve | 0→1 零点曲线 | 左右偏移曲线。Left/right offset curve. |
YOffsetRangeMap | FVector4f | (0,1,10000,1) | 左右偏移-距离映射乘数。Left/right offset distance mapping multiplier. |
ZOffset | FRuntimeFloatCurve | 0→1 零点曲线 | 上下偏移曲线。Up/down offset curve. |
ZOffsetRangeMap | FVector4f | (0,1,10000,1) | 上下偏移-距离映射乘数。Up/down offset distance mapping multiplier. |
XOffsetRandomMult | FVector2f | (1,1) | X 偏移随机乘数范围(最小, 最大)。X offset random multiplier range (min, max). |
YOffsetRandomMult | FVector2f | (1,1) | Y 偏移随机乘数范围。Y offset random multiplier range. |
ZOffsetRandomMult | FVector2f | (1,1) | Z 偏移随机乘数范围。Z offset random multiplier range. |
FProjectileMoving_Interped USTRUCT
插值投射物的移动运行时状态 fragment,派生自 FA_MassBattleBaseFragment。
Interped projectile movement runtime state fragment derived from FA_MassBattleBaseFragment.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
FromPoint | FVector | (0,0,0) | 起点。Start point. |
ToPoint | FVector | (0,0,0) | 终点。End point. |
Target | FEntityHandle | 无效句柄 | 目标实体。Target entity. |
TargetOffset | FVector3f | (0,0,0) | 目标偏移量。Target offset. |
BirthTime | float | 0 | 生成时间。Spawn time. |
XOffsetMult | float | 1 | X 偏移乘数。X offset multiplier. |
YOffsetMult | float | 1 | Y 偏移乘数。Y offset multiplier. |
ZOffsetMult | float | 1 | Z 偏移乘数。Z offset multiplier. |
FProjectileMove_Ballistic USTRUCT
弹道投射物的移动配置 fragment,派生自 FA_MassBattleBaseFragment。求解模式决定使用仰角(FromPitch)还是初速度(FromSpeed)。
Ballistic projectile movement config fragment derived from FA_MassBattleBaseFragment. The solve mode decides between pitch (FromPitch) and initial speed (FromSpeed).
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
MaxSpeed | float | 10000 | 最大速度。Maximum speed. |
Gravity | float | -980 | 重力加速度。Gravity. |
Iterations | int32 | 3 | 预判精度(迭代次数)。Prediction accuracy (iteration count). |
SolveMode | EProjectileSolveMode | FromPitch | 弹道计算模式(见枚举)。Trajectory calculation mode (see the enum). |
Pitch | float | 35 | 抛射仰角(度)。仅 SolveMode == FromPitch 时可编辑。Launch pitch angle in degrees. Editable only when SolveMode == FromPitch. |
Speed | float | 3000 | 初速度。仅 SolveMode == FromSpeed 时可编辑。Initial velocity. Editable only when SolveMode == FromSpeed. |
bFavorHighArc | bool | false | 选择高抛弹道还是平抛弹道。仅 SolveMode == FromSpeed 时可编辑。Choose a high or flat arc trajectory. Editable only when SolveMode == FromSpeed. |
FProjectileMoving_Ballistic USTRUCT
弹道投射物的移动运行时状态 fragment,派生自 FA_MassBattleBaseFragment。
Ballistic projectile movement runtime state fragment derived from FA_MassBattleBaseFragment.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
FromPoint | FVector | (0,0,0) | 起点。Start point. |
ToPoint | FVector | (0,0,0) | 终点。End point. |
InitialVelocity | FVector3f | (0,0,0) | 初速度。Initial velocity. |
BirthTime | float | 0 | 生成时间。Spawn time. |
FProjectileMove_Tracking USTRUCT
追踪投射物的移动配置 fragment,派生自 FA_MassBattleBaseFragment。前向加速 + 横向(转向)加速模型,转弯半径 = 速度² / 横向加速度。
Tracking projectile movement config fragment derived from FA_MassBattleBaseFragment. Forward acceleration + lateral (turn) acceleration model; turn radius = Speed² / LateralAccel.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
MaxSpeed | float | 5000 | 最大速度。Maximum speed. |
Speed | float | 1000 | 初速度。Initial speed. |
Acceleration | float | 1000 | 前向加速度(厘米/秒²)。Forward acceleration (cm/s²). |
LateralAcceleration | float | 2000.0f | 最大横向(转向)加速度(厘米/秒²)。值越高 = 转向越紧(0 = 瞬间转向)。物理:转弯半径 = 速度² / 横向加速度。下限 0。Maximum lateral (turn) acceleration in cm/s². Higher = tighter turns (0 = instant turn). Physics: TurnRadius = Speed² / LateralAccel. Clamped at 0. |
bPredictTargetMovement | bool | true | 启用目标预测(提前瞄准移动目标)。Enable target prediction (leads moving targets). |
PredictionMultiplier | float | 1.0f | 目标预测时间乘数(0–5)。仅 bPredictTargetMovement 时可编辑。Prediction time multiplier for leading the target (0–5). Editable only when bPredictTargetMovement. |
FProjectileMoving_Tracking USTRUCT
追踪投射物的移动运行时状态 fragment,派生自 FA_MassBattleBaseFragment。bHasValidTarget 为普通 bool(非位域),每 tick 被追踪处理器改写并进哈希。
Tracking projectile movement runtime state fragment derived from FA_MassBattleBaseFragment. bHasValidTarget is a plain bool (not a bitfield), rewritten per tick by the tracking processor and folded into the hash.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
FromPoint | FVector | (0,0,0) | 起点。Start point. |
ToPoint | FVector | (0,0,0) | 目标最后已知位置。Target's last known position. |
Target | FEntityHandle | 无效句柄 | 目标实体句柄。Target entity handle. |
TargetOffset | FVector3f | (0,0,0) | 目标偏移量。Target offset. |
FlightDirection | FVector3f | (1,0,0) | 当前速度方向(归一化)。Current velocity direction (normalized). |
CurrentSpeed | float | 0.0f | 当前速度(厘米/秒)。Current speed (cm/s). |
bHasValidTarget | bool | false | 目标当前有效且可追踪。快照注册表字段。Target is currently valid and trackable. Snapshot registry field. |
FProjectileMultipliers(与四个子结构) USTRUCT ×5
投射物参数乘数聚合(普通 USTRUCT,非 fragment):FProjectileMultipliers 聚合四种移动模型的乘数子结构——Static(缩放/伤害)、Interped(缩放/伤害/速度/三轴偏移)、Ballistic(缩放/伤害/重力/仰角/初速)、Tracking(缩放/伤害/初速/加速度/横向加速度)。全部默认 1(不变)。
Projectile parameter multiplier aggregation (plain USTRUCTs, not fragments): FProjectileMultipliers aggregates the multiplier sub-structs of the four movement models — Static (scale/damage), Interped (scale/damage/speed/3-axis offsets), Ballistic (scale/damage/gravity/pitch/initial speed) and Tracking (scale/damage/initial speed/acceleration/lateral acceleration). All default to 1 (identity).
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
Static | FProjectileMultipliers_Static | — | 静态投射物乘数(ScaleMult / DmgMult)。Static projectile multipliers (ScaleMult / DmgMult). |
Interped | FProjectileMultipliers_Interped | — | 插值投射物乘数(ScaleMult / DmgMult / SpeedMult / X/Y/ZOffsetMult)。Interped projectile multipliers (ScaleMult / DmgMult / SpeedMult / X/Y/ZOffsetMult). |
Ballistic | FProjectileMultipliers_Ballistic | — | 弹道投射物乘数(ScaleMult / DmgMult / GravityMult / PitchMult / SpeedMult)。Ballistic projectile multipliers (ScaleMult / DmgMult / GravityMult / PitchMult / SpeedMult). |
Tracking | FProjectileMultipliers_Tracking | — | 追踪投射物乘数(ScaleMult / DmgMult / SpeedMult / AccelerationMult / LateralAccelerationMult)。Tracking projectile multipliers (ScaleMult / DmgMult / SpeedMult / AccelerationMult / LateralAccelerationMult). |
FProjectileConfig USTRUCT
EntityConfig 中投射物生成条的原始配置(普通 USTRUCT,非 fragment)。运行时由子系统展开为 FProjectileConfig_Final。含数据资产、乘数、偏移、附着、延时、动画绑定、继承配置、概率与行为状态关联。
Raw config of one projectile spawn entry in EntityConfig (plain USTRUCT, not a fragment). Expanded at runtime by the subsystem into FProjectileConfig_Final. Includes data asset, multipliers, offset, attachment, delay, anim binding, inheritance config, probability and behavior-state association.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
bEnable | bool | true | 启用。Enable. |
ProjectileConfigDataAsset | TSoftObjectPtr<UMassBattleProjectileConfigDataAsset> | — | 子弹数据资产(软引用)。Projectile data asset (soft reference). |
ProjectileConfigDataAssetPtr | TObjectPtr<UMassBattleProjectileConfigDataAsset> | — | 子弹数据资产指针(运行时解析)。Projectile data asset pointer (resolved at runtime). |
Multipliers | FProjectileMultipliers | — | 子弹参数乘数。Projectile parameter multipliers. |
Transform | FTransform3f | Identity | 偏移量。Offset. |
bAttached | bool | false | 是否附着。Whether attached. |
bDespawnWhenNoParent | bool | true | 附着点失效后自毁。仅当启用且 bAttached 为 true 时可编辑。Destroy when the attachment point becomes invalid. Editable only when enabled and bAttached is true. |
SpawnOrigin | ESpawnOrigin | AtSelf | 生成原点。Spawn origin. |
Delay | float | 0 | 延时生成(秒)。Spawn delay (seconds). |
BindToAnimIndex | int32 | -1 | 绑定到特定动画索引。>= 0 时仅在使用该动画索引时生成;-1 则对所有动画生成。Bind to a specific animation index. If >= 0, spawns only when using that index; -1 spawns for all animations. |
InheritFromInstigator | FInheritFromInstigator | — | 从发起者 Agent 继承配置(定义于 MassBattleStructs.h)。Inheritance config from the instigator agent (defined in MassBattleStructs.h). |
SpawnProbability | FVector4f | (0,1,10000,1) | 生成概率映射。AgentCount 是具有指定行为的 Agent 数量,不是总数。Spawn probability map. AgentCount is the number of agents with the specified behavior, not the total. |
AgentBehaviorState | EAgentBehaviorState | None | 该投射物关联的 Agent 行为状态(用于概率计算)。Agent behavior state this projectile is associated with (used for probability). |
FProjectileConfig_Final USTRUCT
投射物生成条的运行时最终配置 fragment,派生自 FA_MassBattleBaseFragment,声明为不可平凡拷贝(含 TArray/模板数据)。前部字段与 FProjectileConfig 对应(转换构造拷贝),后部为运行时字段:随机流、归属/附着/目标句柄、生成变换、起点/终点、目标速度、初始化/生成/池化状态与模板数据。提供 Reset() 供池复用。
Runtime final config fragment of a projectile entry, derived from FA_MassBattleBaseFragment, declared not-trivially-copyable (contains TArray/template data). Front fields mirror FProjectileConfig (copied by the converting ctor); rear holds runtime fields: random stream, owner/attach/target handles, spawn transform, from/to points, target velocity, init/spawn/pool state and template data. Provides Reset() for pool reuse.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
bEnable | bool | true | 启用(自 FProjectileConfig 拷贝)。Enable (copied from FProjectileConfig). |
ProjectileConfigDataAsset | TSoftObjectPtr<UMassBattleProjectileConfigDataAsset> | — | 子弹数据资产(软引用)。Projectile data asset (soft reference). |
ProjectileConfigDataAssetPtr | TObjectPtr<UMassBattleProjectileConfigDataAsset> | — | 子弹数据资产指针。Projectile data asset pointer. |
Multipliers | FProjectileMultipliers | — | 子弹参数乘数。Projectile parameter multipliers. |
Transform | FTransform3f | Identity | 偏移量。Offset. |
bAttached | bool | false | 是否附着。Whether attached. |
bDespawnWhenNoParent | bool | true | 附着点失效后自毁。仅当启用且 bAttached 为 true 时可编辑。Destroy when the attachment point becomes invalid. Editable only when enabled and bAttached is true. |
SpawnOrigin | ESpawnOrigin | AtSelf | 生成原点。Spawn origin. |
Delay | float | 0 | 延时生成。Spawn delay. |
BindToAnimIndex | int32 | -1 | 绑定的动画索引(>= 0 仅该动画生成,-1 全部)。Bound animation index (>= 0 spawns only for that animation, -1 all). |
InheritFromInstigator | FInheritFromInstigator | — | 从发起者继承配置。Inheritance config from the instigator. |
SpawnProbability | FVector4f | (0,1,10000,1) | 生成概率映射。Spawn probability map. |
AgentBehaviorState | EAgentBehaviorState | None | 关联的 Agent 行为状态。Associated agent behavior state. |
RandomStream | FRandomStream | — | 概率检查的随机流。Random stream for probability checks. |
OwnerEntity | FEntityHandle | 无效句柄 | 生成者实体。Owner entity. |
AttachToEntity | FEntityHandle | 无效句柄 | 附着到的实体。Entity to attach to. |
TargetEntity | FEntityHandle | 无效句柄 | 目标实体。Target entity. |
SpawnTransform | FTransform | Identity | 生成变换。Spawn transform. |
InitialRelativeTransform | FTransform3f | Identity | 初始相对变换。Initial relative transform. |
FromPoint | FVector | (0,0,0) | 起点。From point. |
ToPoint | FVector | (0,0,0) | 终点。To point. |
TargetVelocity | FVector3f | (0,0,0) | 目标速度(用于预测)。Target velocity (for prediction). |
bInitialized | bool | false | 运行时标志:是否已初始化(空 Tooltip)。Runtime flag: whether initialized (no tooltip). |
bSpawned | bool | false | 运行时标志:是否已生成(空 Tooltip)。Runtime flag: whether spawned (no tooltip). |
bIsPooled | bool | false | 运行时标志:是否在池中(空 Tooltip)。Runtime flag: whether pooled (no tooltip). |
bShouldDestroy | bool | false | 设置为 true 时,宿主实体将在下一帧被销毁。When set to true, the host entity will be destroyed on the next tick. |
PoolCountdown | float | 15.0f | 池中倒计时(空 Tooltip)。Pool countdown (no tooltip). |
TemplateData | FMassEntityTemplateData | — | 缓存的目标实体模板数据。Cached target entity template data. |
SpawnedProjectile | FEntityHandle | 无效句柄 | 已生成的投射物实体句柄——快照注册表字段(恢复按 UID 解析)。Handle of the spawned projectile entity — snapshot registry field (restore resolves via UID). |
方法 Methods
复位运行时状态:初始化/生成/销毁标志清 false、bIsPooled = true、PoolCountdown = InPoolIdleTTL、模板数据清空、四个句柄清为无效。InPoolIdleTTL 为统一的池闲置倒计时(来自 UMassBattleHostSubsystem 的 PoolIdleLifeSpan);默认值 15 保证非回收调用点行为不变。
Resets runtime state: init/spawn/destroy flags to false, bIsPooled = true, PoolCountdown = InPoolIdleTTL, template data cleared, four handles invalidated. InPoolIdleTTL is the unified pool idle countdown (the UMassBattleHostSubsystem PoolIdleLifeSpan); the 15.0f default keeps non-recycle call sites unchanged.
Input
| 参数 Param | 类型 Type | 说明 Description |
|---|---|---|
InPoolIdleTTL | float | 复位后的池闲置倒计时(秒),默认 15。Pool idle countdown (seconds) after the reset; defaults to 15. |
Output
无返回值。副作用:运行时成员复位(配置字段不变)。
No return value. Side effect: runtime members reset (config fields unchanged).
转换构造:把 FProjectileConfig 的配置字段逐一拷贝,运行时字段保持默认。
Converting ctor: copies each config field from FProjectileConfig; runtime fields keep their defaults.
Input
| 参数 Param | 类型 Type | 说明 Description |
|---|---|---|
Config | const FProjectileConfig& | 源配置条目。Source config entry. |
Output
无返回值。副作用:初始化全部配置字段。
No return value. Side effect: initializes all config fields.
FProjectileSpawn USTRUCT
投射物生命周期生成表 fragment,派生自 FA_MassBattleBaseFragment,声明为不可平凡拷贝(含 TArray/TMap)。按出生 / 击中 / 移除三个时机组织,击中内容可再按命中障碍物的物理表面类型细分(OnSurfaceHit,未配置对应表面时回退 OnHit)。内容结构 FProjectileSpawnContent 携带投射物/Actor/FX/音效四类列表。
Lifecycle spawn table fragment for projectiles, derived from FA_MassBattleBaseFragment, declared not-trivially-copyable (contains TArray/TMap). Organized by the birth / hit / removal moments; the hit content can be further split by the hit obstacle's physical surface type (OnSurfaceHit, falling back to OnHit when the surface is not configured). The content struct FProjectileSpawnContent carries projectile/actor/FX/sound lists.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
OnBirth | FProjectileSpawnContent | — | 出生时生成什么。What to spawn on projectile begin play. |
OnSurfaceHit | TMap<TEnumAsByte<EPhysicalSurface>, FProjectileSpawnContent> | 空 | 命中特定物理表面的障碍物时生成什么(MassBattleProjectileMonoProcessor 以 UPhysicalMaterial::DetermineSurfaceType 判定命中表面;该表面已配置且为阻挡命中时走对应内容,否则回退 OnHit)。What to spawn when the projectile hits an obstacle of a specific physical surface (MassBattleProjectileMonoProcessor resolves the surface via UPhysicalMaterial::DetermineSurfaceType; configured surface + blocking hit uses the matching content, otherwise it falls back to OnHit). |
OnHit | FProjectileSpawnContent | — | 击中时生成什么。What to spawn on projectile hit something. |
OnRemoval | FProjectileSpawnContent | — | 移除时生成什么。What to spawn on projectile end play. |
FProjectileSpawnContent 成员 FProjectileSpawnContent members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
bEnable | bool | false | 启用/禁用生成。Enable/disable spawning. |
SpawnProjectile | TArray<FProjectileConfig> | 空 | 要生成的投射物。Projectiles to spawn. |
SpawnActor | TArray<FActorSpawnConfig_Attack> | 空 | 要生成的 Actor。Actors to spawn. |
SpawnFx | TArray<FFxConfig_Attack> | 空 | 要生成的特效。FX to spawn. |
PlaySound | TArray<FSoundConfig_Attack> | 空 | 要播放的声音。Sounds to play. |
FProjectileOptCommand USTRUCT
投射物宿主操作命令记录(USTRUCT,非 fragment)。携带实体句柄与 OwnerUniqueID(-1 = 无效)——用于确定性排序。
Projectile host-ops command record (USTRUCT, not a fragment). Carries the entity handle and OwnerUniqueID (-1 = invalid) — used for deterministic sorting.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
Entity | FMassEntityHandle | — | 目标实体句柄。Target entity handle. |
OwnerUniqueID | int32 | -1 | 生成者 UID,用于确定性排序。Owner UID, for deterministic sorting. |
管线角色 Pipeline Role
grep 验证:FProjectileParamsRT / FProjectileConfig_Final 被 MassBattleProjectileSubsystem(生成/池化)、MassBattleProjectileMonoProcessor(移动/碰撞/伤害/触发)、MassBattleHostMonoProcessor(宿主生命周期)、MassBattleNetworkProcessor 与 MassBattleNetworkSubsystem(快照同步)引用。
Verified by grep: FProjectileParamsRT / FProjectileConfig_Final are referenced by MassBattleProjectileSubsystem (spawn/pool), MassBattleProjectileMonoProcessor (movement/collision/damage/triggers), MassBattleHostMonoProcessor (host lifecycle), MassBattleNetworkProcessor and MassBattleNetworkSubsystem (snapshot sync).