载入中...
搜索中...
未找到
WeaponSystem.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
11#include "weapon/WeaponTypes.h"
12
13#include <functional>
14#include <string>
15
16namespace eve::weapon {
17
18class IWeaponLogic;
19
21using WeaponEventSink = std::function<void(const WeaponEvent&)>;
22
25public:
27 static void registerLogic(IWeaponLogic* logic);
36 static IWeaponLogic* findLogic(const std::string& name);
38 static int logicCount();
39
41 static void setEventSink(WeaponEventSink sink);
42
44 static void emitEvent(const WeaponEvent& e);
45
47 static void update(WeaponEntity& w, float dt);
48
50 static bool tryFire(WeaponEntity& w, const FireRequest& req);
51
53 static bool canFire(WeaponEntity& w);
54
56 static void startReload(WeaponEntity& w);
57
59 static void cancelReload(WeaponEntity& w);
60
62 static bool updateAim(WeaponEntity& w, float dt);
63};
64
65} // namespace eve::weapon
float w
Definition AnimClip.cpp:738
#define EVENGINE_API_WORLD
Definition Export.h:109
std::string name
武器逻辑接口:注册到 WeaponSystem 的可插拔行为。
Definition WeaponLogic.h:22
武器实体:数据全部在组件里,行为在 WeaponSystem。
武器系统:逻辑注册 + 更新 + 开火 + 装填。
载具模块入口(eve.Vehicle):定义注册 / 实体工厂 / RTS 命令 / 帧调度。 设计文档:docs/dev/通用载具系统设计.md
std::function< void(const WeaponEvent &)> WeaponEventSink
事件汇:由 Weapon 模块(或测试)注册,把事件写入自己的队列。
一次攻击请求(C++ 系统 / 脚本发起)。角度均为度。 旧名 FireRequest 保留为别名,向后兼容。
武器事件(帧缓存,脚本轮询,与 building/rpg 风格一致)。