ngl_server 1.0
基于 Actor 模型的 C++ 服务器框架
ngl::nbt_decorator_node< TACTOR > Class Template Referencefinal

装饰器节点包装类(单个子节点)。 More...

#include <nbt.h>

Inheritance diagram for ngl::nbt_decorator_node< TACTOR >:

Public Member Functions

 nbt_decorator_node (const std::string &aname, const BT::NodeConfig &aconfig, nbt_decorator_callback< TACTOR > afun)
 构造函数。
nbt_status tick () override
 执行装饰器tick。

Detailed Description

template<typename TACTOR>
class ngl::nbt_decorator_node< TACTOR >

装饰器节点包装类(单个子节点)。

继承自BT::DecoratorNode,先tick子节点,然后将子节点结果传递给回调。 回调决定最终状态,可实现反转、重复、超时等逻辑。

Template Parameters
TACTORActor类型
Note
回调函数接收子节点的tick结果作为额外参数。
通过child()和haltChildren()访问子节点。

Constructor & Destructor Documentation

◆ nbt_decorator_node()

template<typename TACTOR>
ngl::nbt_decorator_node< TACTOR >::nbt_decorator_node ( const std::string & aname,
const BT::NodeConfig & aconfig,
nbt_decorator_callback< TACTOR > afun )
inline

构造函数。

Parameters
aname节点实例名称
aconfig节点配置
afun装饰器回调函数

Member Function Documentation

◆ tick()

template<typename TACTOR>
nbt_status ngl::nbt_decorator_node< TACTOR >::tick ( )
inlineoverride

执行装饰器tick。

先tick子节点获取结果,再调用回调函数决定最终状态。

Returns
装饰器处理后的节点状态

The documentation for this class was generated from the following file: