--- --- Generated by EmmyLua(https://github.com/EmmyLua) --- Created by PZM. --- DateTime: 2025/1/20 9:34 ---@class BTTest BTTest = {} local this = BTTest function this.Init() ---@type BehaviorTree this.btEventTest = BTEventTest(this).BTree this.btEventTest:Start() end ---@class BTEventTest: BehaviorEvent BTEventTest = class(SL.BtTree:BehaviorEvent()) local this= BTEventTest function this:ctor(mgr) SL.BtTree:BehaviorEvent().ctor(self, mgr) end function this:Init() local root = nil root = IfNode(this.IsAutoDragVaild, BTNodeTest() ) self.BTree = SL.BtTree:BehaviorTree()(root, self) end function this:Start() if not self.BTree:IsUpdateIn() then self.BTree:Reset() self.BTree:Start() end end function this:IsUpdateIn() return self.BTree:IsUpdateIn() end function this:Stop() self.BTree:Cancel() end function this.IsAutoDragVaild() return true end ---@class BTNodeTest:BehaviorNode BTNodeTest = class(BehaviorNode) local this = BTNodeTest function this:ctor() BehaviorNode.ctor(self) --self.kind = BehaviorNodeEnum.HPProtectNode --self.nodeName = BehaviorNodeStringEnum[self.kind] self.kind = table.count(BehaviorNodeEnum)+1 --自定义枚举值 self.nodeName = "自定义节点名称" end function this:Visit() local bUseOk = true if bUseOk then SL:LogError('BTNodeTest Visit') self.status = BehaviorStatusEnum.SUCCESS else self.status = BehaviorStatusEnum.FAILED end end BTTest.Init()