Documentation ¶
Index ¶
- type Action
- type DynamicSubtree
- func (t *DynamicSubtree) CanDynamicDecorate() bool
- func (t *DynamicSubtree) DynamicDecorate(brain bcore.IBrain, decorated bcore.IRoot)
- func (t *DynamicSubtree) OnChildFinished(brain bcore.IBrain, child bcore.INode, succeeded bool)
- func (t *DynamicSubtree) PropertiesClassProvider() any
- func (t *DynamicSubtree) Tag() string
- type DynamicSubtreeProperties
- type IDynamicSubtree
- type IDynamicSubtreeProperties
- type ISubtree
- type ISubtreeProperties
- type IWaitBBProperties
- type IWaitProperties
- type Subtree
- func (t *Subtree) GetPropChildID() string
- func (t *Subtree) GetPropChildTag() string
- func (t *Subtree) OnAbort(brain bcore.IBrain)
- func (t *Subtree) OnChildFinished(brain bcore.IBrain, child bcore.INode, succeeded bool)
- func (t *Subtree) OnStart(brain bcore.IBrain)
- func (t *Subtree) PropertiesClassProvider() any
- func (t *Subtree) SubtreeProperties() ISubtreeProperties
- type SubtreeProperties
- type Wait
- type WaitBB
- type WaitBBProperties
- type WaitProperties
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DynamicSubtree ¶
type DynamicSubtree struct {
Subtree
}
DynamicSubtree 动态子树容器
可以在运行时动态更换子节点
func (*DynamicSubtree) CanDynamicDecorate ¶
func (t *DynamicSubtree) CanDynamicDecorate() bool
CanDynamicDecorate 标志可以运行时动态挂载子节点
@implement bcore.IDecoratorWorker .CanDynamicDecorate @receiver t @return bool
func (*DynamicSubtree) DynamicDecorate ¶ added in v1.0.3
func (t *DynamicSubtree) DynamicDecorate(brain bcore.IBrain, decorated bcore.IRoot)
DynamicDecorate
@implement IDynamicSubtree.DynamicDecorate @receiver d @param brain @param decorated @param abort
func (*DynamicSubtree) OnChildFinished ¶ added in v1.0.3
OnChildFinished
@override Decorator.OnChildFinished @receiver s @param brain @param child @param succeeded
func (*DynamicSubtree) PropertiesClassProvider ¶
func (t *DynamicSubtree) PropertiesClassProvider() any
PropertiesClassProvider
@implement INodeWorker.PropertiesClassProvider @receiver n @return any
func (*DynamicSubtree) Tag ¶ added in v1.0.3
func (t *DynamicSubtree) Tag() string
type DynamicSubtreeProperties ¶
type DynamicSubtreeProperties struct { SubtreeProperties Tag string `json:"tag"` // 标签,用于识别子树 RunMode bcore.DynamicBehaviorMode `json:"runMode"` // 动态子树中断模式 }
DynamicSubtreeProperties 子树容器属性
func (*DynamicSubtreeProperties) GetRunMode ¶ added in v1.0.3
func (p *DynamicSubtreeProperties) GetRunMode() bcore.DynamicBehaviorMode
func (*DynamicSubtreeProperties) GetTag ¶
func (p *DynamicSubtreeProperties) GetTag() string
type IDynamicSubtree ¶
type IDynamicSubtree interface { ISubtree Tag() string // DynamicDecorate 动态装饰子节点 // // 非线程安全,由调用方自己保证 // @param brain // @param decorated DynamicDecorate(brain bcore.IBrain, decorated bcore.IRoot) }
IDynamicSubtree 动态子树容器
可以在运行时动态更换子节点
type IDynamicSubtreeProperties ¶
type IDynamicSubtreeProperties interface { GetTag() string GetRunMode() bcore.DynamicBehaviorMode }
type ISubtree ¶
type ISubtree interface { bcore.IDecorator // GetPropChildID 获取配置中的子节点ID // @return string GetPropChildID() string // GetPropChildTag 获取配置中的子节点Tag // @return string GetPropChildTag() string }
ISubtree 静态子树容器
只能在初始化时添加子节点,不允许在运行时改变子节点
type ISubtreeProperties ¶
type IWaitBBProperties ¶
type IWaitProperties ¶
type Subtree ¶
Subtree 静态子树容器
只能在初始化时添加子节点,不允许在运行时改变子节点
func (*Subtree) GetPropChildID ¶
GetPropChildID
@implement ISubtree.GetPropChildID @receiver s @return string
func (*Subtree) GetPropChildTag ¶ added in v1.0.3
GetPropChildTag
@implement ISubtree.GetPropChildTag @receiver s @return string
func (*Subtree) OnChildFinished ¶
OnChildFinished
@override bcore.Decorator .OnChildFinished @receiver s @param brain @param child @param succeeded
func (*Subtree) PropertiesClassProvider ¶
PropertiesClassProvider
@implement INodeWorker.PropertiesClassProvider @receiver n @return any
func (*Subtree) SubtreeProperties ¶
func (t *Subtree) SubtreeProperties() ISubtreeProperties
type SubtreeProperties ¶
type SubtreeProperties struct { ChildID string `json:"childID"` // 默认子节点ID ChildTag string `json:"childTag"` // 默认子节点Tag IsSuccessWhenNotChild bool `json:"isSuccessWhenNotChild"` // 无子节点时执行是否返回成功 }
SubtreeProperties 子树容器属性
func (*SubtreeProperties) GetChildID ¶ added in v1.0.3
func (s *SubtreeProperties) GetChildID() string
func (*SubtreeProperties) GetChildTag ¶ added in v1.0.3
func (s *SubtreeProperties) GetChildTag() string
func (*SubtreeProperties) GetIsSuccessWhenNotChild ¶
func (s *SubtreeProperties) GetIsSuccessWhenNotChild() bool
type Wait ¶
Wait 等待
任务节点可以在行为树中使用,使树在此节点上等待,直至指定的 等待时间(Wait Time) 结束。
func (*Wait) PropertiesClassProvider ¶
PropertiesClassProvider
@implement INodeWorker.PropertiesClassProvider @receiver n @return any
func (*Wait) WaitProperties ¶
func (w *Wait) WaitProperties() IWaitProperties
type WaitBB ¶
WaitBB 等待黑板时间
与 等待 WaitBB 任务节点的原理类似,但该节点会拉取等待时间黑板值。
func (*WaitBB) PropertiesClassProvider ¶
PropertiesClassProvider
@implement INodeWorker.PropertiesClassProvider @receiver n @return any
func (*WaitBB) WaitBBProperties ¶
func (w *WaitBB) WaitBBProperties() IWaitBBProperties
type WaitBBProperties ¶
type WaitBBProperties struct { Key string `json:"key"` // 引用的黑板键,确定等待时间 RandomDeviation util.Duration `json:"randomDeviation"` // 随机偏差:允许向 等待时间(WaitTime)属性添加随机时间 WaitTime=WaitTime+RandomDeviation*[-0.5,0.5) }
WaitBBProperties 等待黑板时间属性
func (*WaitBBProperties) GetKey ¶
func (w *WaitBBProperties) GetKey() string
func (*WaitBBProperties) GetRandomDeviation ¶
func (w *WaitBBProperties) GetRandomDeviation() time.Duration
type WaitProperties ¶
type WaitProperties struct { WaitTime util.Duration `json:"waitTime"` // 等待时间 RandomDeviation util.Duration `json:"randomDeviation"` // 随机偏差:允许向 等待时间 WaitTime 属性添加随机时间。 WaitTime = WaitTime + RandomDeviation * [-0.5,0.5) Forever bool `json:"forever"` // 永久等待直到被外界打断 ResultOnAbort bool `json:"resultOnAbort"` // 中断时返回成功还是失败,默认false }
WaitProperties 等待属性
func (*WaitProperties) GetForever ¶
func (w *WaitProperties) GetForever() bool
func (*WaitProperties) GetRandomDeviation ¶
func (w *WaitProperties) GetRandomDeviation() time.Duration
func (*WaitProperties) GetResultOnAbort ¶ added in v1.0.6
func (w *WaitProperties) GetResultOnAbort() bool
func (*WaitProperties) GetWaitTime ¶
func (w *WaitProperties) GetWaitTime() time.Duration
Click to show internal directories.
Click to hide internal directories.