IMassBattleLootInterface
Source/MassBattle/Public/Interfaces/MassBattleLootInterface.h
概述 Overview
loot(战利品)生命周期事件的对外回调接口(Blueprintable,事件均为 BlueprintNativeEvent)。声明三个事件:生成(OnLootSpawn)、收集(OnLootCollect)、销毁(OnLootDestroy),载荷为同文件定义的两个半结构 —— FLootSpawnData / FLootDestroyData(实体 + UID)与更丰富的 FLootCollectData(战利品/收集者实体、加分、收集位置、UID)。分发路径:LootMonoProcessor 把事件推入 UMassBattleSubsystem 的 OnLoot*Queue,ProcessEventQueues 串行消费并 Execute_OnLoot* 分发给接收者(通常为 FLootEventRT.EventReceiveActor 绑定的 Actor)。
Outward callback interface for loot lifecycle events (Blueprintable; all events BlueprintNativeEvent). Declares three events: spawn (OnLootSpawn), collect (OnLootCollect), destroy (OnLootDestroy), with payloads defined in this same file — FLootSpawnData / FLootDestroyData (entity + UID) and the richer FLootCollectData (loot/gatherer entities, score added, collection location, UID). Dispatch path: LootMonoProcessor pushes events into the OnLoot*Queue of UMassBattleSubsystem; ProcessEventQueues drains serially and dispatches Execute_OnLoot* to the receiver (usually the Actor bound as FLootEventRT.EventReceiveActor).
结构体 Structs
loot 生成事件载荷:自身实体句柄与 UID。
Loot spawn event payload: the self entity handle and UID.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
SelfEntity | FEntityHandle | — | 自身 loot 实体句柄。The loot entity handle itself. |
UniqueID | int32 | -1 | 实体唯一 ID(-1 = 无效)。Entity unique ID (-1 = invalid). |
loot 收集事件载荷:战利品与收集者实体、本次加分、收集位置与 UID。
Loot collect event payload: the loot and gatherer entities, score added, collection location, and UID.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
LootEntity | FEntityHandle | — | 被收集的 loot 实体。The loot entity being collected. |
GathererEntity | FEntityHandle | — | 收集者实体。The gatherer entity. |
ScoreAdded | int32 | 0 | 本次收集增加的分数。Score added by this collection. |
CollectionLocation | FVector | ZeroVector | 收集发生位置。Location where the collection happened. |
UniqueID | int32 | -1 | 实体唯一 ID(-1 = 无效)。Entity unique ID (-1 = invalid). |
loot 销毁事件载荷:自身实体、UID 与过期标志(bExpired 区分过期销毁与被摧毁)。
Loot destroy event payload: the self entity, UID, and the expired flag (distinguishing expiry from destruction).
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
SelfEntity | FEntityHandle | — | 自身 loot 实体句柄。The loot entity handle itself. |
UniqueID | int32 | -1 | 实体唯一 ID(-1 = 无效)。Entity unique ID (-1 = invalid). |
bExpired | bool | false | 是否因寿命耗尽而销毁(区别于被收集/摧毁)。Whether destroyed by lifespan expiry (vs. collected/destroyed). |
接口方法 Interface Methods
loot 生成事件:战利品实体生成时触发。事件由 LootMonoProcessor 推入 OnLootSpawnQueue。
Loot spawn event: triggered when the loot entity spawns. Pushed into OnLootSpawnQueue by LootMonoProcessor.
Input
| 参数 Param | 类型 Type | 说明 Description |
|---|---|---|
Data | const FLootSpawnData& | 含 SelfEntity 与 UniqueID。Contains SelfEntity and UniqueID. |
Output
无返回值。无内置副作用(行为由实现方决定)。
No return value. No built-in side effects (behavior is up to the implementer).
loot 收集事件:战利品被收集时触发。事件由 LootMonoProcessor 推入 OnLootCollectQueue。
Loot collect event: triggered when the loot is collected. Pushed into OnLootCollectQueue by LootMonoProcessor.
Input
| 参数 Param | 类型 Type | 说明 Description |
|---|---|---|
Data | const FLootCollectData& | 含 LootEntity、GathererEntity、ScoreAdded、CollectionLocation、UniqueID。Contains LootEntity, GathererEntity, ScoreAdded, CollectionLocation, UniqueID. |
Output
无返回值。无内置副作用。
No return value. No built-in side effects.
loot 销毁事件:战利品销毁(含寿命过期)时触发。事件由 LootMonoProcessor 推入 OnLootDestroyQueue。
Loot destroy event: triggered when the loot is destroyed (including lifespan expiry). Pushed into OnLootDestroyQueue by LootMonoProcessor.
Input
| 参数 Param | 类型 Type | 说明 Description |
|---|---|---|
Data | const FLootDestroyData& | 含 SelfEntity、UniqueID、bExpired(是否过期销毁)。Contains SelfEntity, UniqueID, bExpired (expiry destroy). |
Output
无返回值。无内置副作用。
No return value. No built-in side effects.
管线角色 Pipeline Role
事件流:LootMonoProcessor 并行段把 Spawn/Collect/Destroy 事件推入 UMassBattleSubsystem 的 OnLootSpawnQueue/OnLootCollectQueue/OnLootDestroyQueue → ProcessEventQueues 串行消费,按 FLootEventRT.EventReceiveActor(loot 无 FVisualizing 绑定)解析接收者,调用 IMassBattleLootInterface::Execute_OnLoot*(Actor, Data)(Collect 按 ByLootEntity、Spawn/Destroy 按 BySelfEntity 解析,见 MassBattleSubsystem.cpp 的 ProcessQueue 段)。
Event flow: LootMonoProcessor pushes Spawn/Collect/Destroy events into OnLootSpawnQueue/OnLootCollectQueue/OnLootDestroyQueue of UMassBattleSubsystem from its parallel section → ProcessEventQueues drains serially, resolving the receiver via FLootEventRT.EventReceiveActor (loot has no FVisualizing binding) and calling IMassBattleLootInterface::Execute_OnLoot*(Actor, Data) (Collect resolves ByLootEntity; Spawn/Destroy BySelfEntity; see the ProcessQueue section of MassBattleSubsystem.cpp).