IMassBattleProjectileInterface
Source/MassBattle/Public/Interfaces/MassBattleProjectileInterface.h
概述 Overview
抛射物生命周期事件的对外回调接口(事件均为 BlueprintNativeEvent)。声明三个事件:生成(OnProjectileSpawn,载荷 FAppearData)、命中(OnProjectileHit,载荷 FHitData)、销毁(OnProjectileDeath,载荷 FDeathData);载荷结构定义于 MassBattleStructs.h,与 agent 接口共用。分发路径:UMassBattleProjectileSubsystem 的生成路径直接推 OnProjectileSpawnQueue,ProjectileMonoProcessor 推 OnProjectileHitQueue/OnProjectileDeathQueue;ProcessEventQueues 串行消费并 Execute_OnProjectile* 分发给接收者(通常为 FProjectileEventRT.EventReceiveActor 绑定的 Actor)。
Outward callback interface for projectile lifecycle events (all events BlueprintNativeEvent). Declares three events: spawn (OnProjectileSpawn, payload FAppearData), hit (OnProjectileHit, payload FHitData), death (OnProjectileDeath, payload FDeathData); the payload structs live in MassBattleStructs.h, shared with the agent interface. Dispatch path: the UMassBattleProjectileSubsystem spawn paths push OnProjectileSpawnQueue directly, while ProjectileMonoProcessor pushes OnProjectileHitQueue/OnProjectileDeathQueue; ProcessEventQueues drains serially and dispatches Execute_OnProjectile* to the receiver (usually the Actor bound as FProjectileEventRT.EventReceiveActor).
接口方法 Interface Methods
抛射物生成事件:抛射物实体出生时触发。事件由 UMassBattleProjectileSubsystem 的各生成路径直接推入 OnProjectileSpawnQueue。
Projectile spawn event: triggered when the projectile entity is born. Pushed into OnProjectileSpawnQueue directly by the UMassBattleProjectileSubsystem spawn paths.
Input
| 参数 Param | 类型 Type | 说明 Description |
|---|---|---|
Data | const FAppearData& | 含 SelfEntity(刚生成的实体)与 UniqueID。Contains SelfEntity (the just-spawned entity) and UniqueID. |
Output
无返回值。无内置副作用(行为由实现方决定)。
No return value. No built-in side effects (behavior is up to the implementer).
抛射物命中事件:抛射物击中目标时触发。事件由 ProjectileMonoProcessor 推入 OnProjectileHitQueue。
Projectile hit event: triggered when the projectile hits a target. Pushed into OnProjectileHitQueue by ProjectileMonoProcessor.
Input
| 参数 Param | 类型 Type | 说明 Description |
|---|---|---|
Data | const FHitData& | 含 SelfEntity(被击中实体)、InstigatorEntity、CauserEntity(如抛射物自身)、IsCritical、IsKill、DmgDealt、HitDirection、HitLocation、DebuffInfo、UniqueID。Contains SelfEntity (the hit entity), InstigatorEntity, CauserEntity (e.g. the projectile itself), IsCritical, IsKill, DmgDealt, HitDirection, HitLocation, DebuffInfo, UniqueID. |
Output
无返回值。无内置副作用。
No return value. No built-in side effects.
抛射物销毁事件:抛射物死亡/销毁时触发。事件由 ProjectileMonoProcessor 推入 OnProjectileDeathQueue。
Projectile death event: triggered when the projectile dies/despawns. Pushed into OnProjectileDeathQueue by ProjectileMonoProcessor.
Input
| 参数 Param | 类型 Type | 说明 Description |
|---|---|---|
Data | const FDeathData& | 含 SelfEntity(死亡的实体)、InstigatorEntity(导致死亡的实体)、State(死亡事件状态,默认 OutOfHealth)、UniqueID。Contains SelfEntity (the dead entity), InstigatorEntity (the entity responsible), State (death event state, default OutOfHealth), UniqueID. |
Output
无返回值。无内置副作用。
No return value. No built-in side effects.
管线角色 Pipeline Role
事件流:UMassBattleProjectileSubsystem 各 SpawnProjectile_* 路径在生成时直接推 OnProjectileSpawnQueue;ProjectileMonoProcessor 并行段推 OnProjectileHitQueue/OnProjectileDeathQueue → UMassBattleSubsystem::ProcessEventQueues 串行消费,按 FProjectileEventRT.EventReceiveActor 解析接收者(Hit 按 ByCauserEntity、Spawn/Death 按 BySelfEntity,见 MassBattleSubsystem.cpp 的 ProcessQueue 段),调用 IMassBattleProjectileInterface::Execute_OnProjectile*(Actor, Data)。
Event flow: the UMassBattleProjectileSubsystem SpawnProjectile_* paths push OnProjectileSpawnQueue at spawn; ProjectileMonoProcessor pushes OnProjectileHitQueue/OnProjectileDeathQueue from its parallel section → UMassBattleSubsystem::ProcessEventQueues drains serially, resolving the receiver via FProjectileEventRT.EventReceiveActor (Hit resolves ByCauserEntity; Spawn/Death BySelfEntity; see the ProcessQueue section of MassBattleSubsystem.cpp) and calling IMassBattleProjectileInterface::Execute_OnProjectile*(Actor, Data).