载入中...
搜索中...
未找到
eve::weapon::WeaponSystem类 参考

武器系统:逻辑注册 + 更新 + 开火 + 装填。 更多...

#include <WeaponSystem.h>

静态 Public 成员函数

static void registerLogic (IWeaponLogic *logic)
 注册武器逻辑实现;同名替换。
 
static IWeaponLogic * findLogic (const std::string &name)
 按名字取逻辑;未注册返回 nullptr。
 
static int logicCount ()
 已注册逻辑数量。
 
static void setEventSink (WeaponEventSink sink)
 注册事件汇(替换旧的;传 nullptr 清空)。
 
static void emitEvent (const WeaponEvent &e)
 向事件汇推一条事件(模块/脚本便捷入口)。
 
static void update (WeaponEntity &w, float dt)
 每帧推进:冷却 / 连发 / 装填 / 炮口旋转 / 逻辑自身。
 
static bool tryFire (WeaponEntity &w, const FireRequest &req)
 尝试开火;满足条件时扣弹药、调逻辑、推事件并返回 true。
 
static bool canFire (WeaponEntity &w)
 是否可开火(未装填/未卡壳/冷却完毕/有弹药/逻辑放行)。
 
static void startReload (WeaponEntity &w)
 开始装填(有备用弹药且弹匣不满时生效)。
 
static void cancelReload (WeaponEntity &w)
 打断装填。
 
static bool updateAim (WeaponEntity &w, float dt)
 炮口朝目标旋转;返回本帧是否到位。
 

详细描述

武器系统:逻辑注册 + 更新 + 开火 + 装填。

在文件 WeaponSystem.h 第 24 行定义.

成员函数说明

◆ cancelReload()

void eve::weapon::WeaponSystem::cancelReload ( WeaponEntity &  w)
static

打断装填。

在文件 WeaponSystem.cpp 第 435 行定义.

引用了 w.

被这些函数引用 eve::weapon::Weapon::cancelReload() , 以及 eve::rts::SupplySystem::step().

◆ canFire()

bool eve::weapon::WeaponSystem::canFire ( WeaponEntity &  w)
static

是否可开火(未装填/未卡壳/冷却完毕/有弹药/逻辑放行)。

在文件 WeaponSystem.cpp 第 404 行定义.

引用了 w.

被这些函数引用 eve::weapon::Weapon::canFire().

◆ emitEvent()

void eve::weapon::WeaponSystem::emitEvent ( const WeaponEvent &  e)
static

向事件汇推一条事件(模块/脚本便捷入口)。

在文件 WeaponSystem.cpp 第 385 行定义.

被这些函数引用 eve::weapon::Weapon::setAiming().

◆ findLogic()

IWeaponLogic * eve::weapon::WeaponSystem::findLogic ( const std::string &  name)
static

按名字取逻辑;未注册返回 nullptr。

返回
Borrowed nullable implementation owned by the registered provider. @ownership WeaponSystem retains the registry entry but does not own the implementation. @lifetime Valid while registered and until replacement/unregister; do not retain across registry mutation. @thread Call on the weapon registry thread. @reentrancy The lookup invokes no callbacks and does not mutate the registry.

在文件 WeaponSystem.cpp 第 376 行定义.

引用了 eve::weapon::IWeaponLogic::end() , 以及 name.

◆ logicCount()

int eve::weapon::WeaponSystem::logicCount ( )
static

已注册逻辑数量。

在文件 WeaponSystem.cpp 第 381 行定义.

被这些函数引用 eve::weapon::Weapon::getLogicCount().

◆ registerLogic()

void eve::weapon::WeaponSystem::registerLogic ( IWeaponLogic *  logic)
static

注册武器逻辑实现;同名替换。

在文件 WeaponSystem.cpp 第 371 行定义.

引用了 eve::weapon::IWeaponLogic::name().

被这些函数引用 eve::weapon::Weapon::registerLogic().

◆ setEventSink()

void eve::weapon::WeaponSystem::setEventSink ( WeaponEventSink  sink)
static

注册事件汇(替换旧的;传 nullptr 清空)。

在文件 WeaponSystem.cpp 第 383 行定义.

被这些函数引用 eve::weapon::Weapon::Weapon() , 以及 eve::weapon::Weapon::~Weapon().

◆ startReload()

void eve::weapon::WeaponSystem::startReload ( WeaponEntity &  w)
static

◆ tryFire()

bool eve::weapon::WeaponSystem::tryFire ( WeaponEntity &  w,
const FireRequest &  req 
)
static

尝试开火;满足条件时扣弹药、调逻辑、推事件并返回 true。

在文件 WeaponSystem.cpp 第 397 行定义.

引用了 w.

被这些函数引用 eve::weapon::Weapon::attack(), eve::weapon::Weapon::fire() , 以及 eve::weapon::Weapon::fireAt().

◆ update()

void eve::weapon::WeaponSystem::update ( WeaponEntity &  w,
float  dt 
)
static

每帧推进:冷却 / 连发 / 装填 / 炮口旋转 / 逻辑自身。

在文件 WeaponSystem.cpp 第 387 行定义.

引用了 w.

被这些函数引用 eve::rts::CombatFireSystem::step() , 以及 eve::weapon::Weapon::update().

◆ updateAim()

bool eve::weapon::WeaponSystem::updateAim ( WeaponEntity &  w,
float  dt 
)
static

炮口朝目标旋转;返回本帧是否到位。

在文件 WeaponSystem.cpp 第 440 行定义.

引用了 step , 以及 w.


该类的文档由以下文件生成: