public BtStatus Tick() { if (ResumeOngoingNodes) { BtStatus status; if (OngoingNode != null) { status = OngoingNode.Execute(); if (status is BtStatus.Failed or BtStatus.Success) { OngoingNode = null; } } else { status = RootNode.Execute(); if (status is BtStatus.Ongoing) { OngoingNode = RootNode.GetNodeToExecute(); } } return(status); } else { return(RootNode.GetNodeToExecute().Execute()); } }
public BehaviorTreeStatus Tick() { if (ResumeOngoingNodes) { if (OngoingNode != null) { BehaviorTreeStatus status = OngoingNode.Execute(); if (status == BehaviorTreeStatus.Failed || status == BehaviorTreeStatus.Success) { OngoingNode = null; } return(status); } else { BehaviorTreeStatus status = RootNode.Execute(); if (status == BehaviorTreeStatus.Ongoing) { OngoingNode = RootNode.GetNodeToExecute(); } return(status); } } else { Node nodeToExecute = RootNode.GetNodeToExecute(); LastExecutedName = nodeToExecute.Name; return(nodeToExecute.Execute()); } }
public BtStatus Tick() { if (BlackboardUpdateEnabled && LastBlackBoardUpdate + BlackboardUpdateTime < DateTime.Now) { Blackboard.Update(); LastBlackBoardUpdate = DateTime.Now; } if (ResumeOngoingNodes) { BtStatus status; if (OngoingNode != null) { status = OngoingNode.Execute(Blackboard); if (status is BtStatus.Failed or BtStatus.Success) { OngoingNode = null; } } else { status = RootNode.Execute(Blackboard); if (status is BtStatus.Ongoing) { OngoingNode = RootNode.GetNodeToExecute(Blackboard); } } return(status); } else { return(RootNode.GetNodeToExecute(Blackboard).Execute(Blackboard)); } }