Reference Links:
72937709
52587364
78596732
0. Node
In general, only need to extend the conditional and action of the two nodes, decorator and composite nodes only need to use the built-in is enough.
For conditional nodes, the success or failure can be returned based on the judging criteria.
For an action node, in addition to success or failure, there is a running state that indicates that the node has not finished executing and the next frame continues to execute the node.
For composite nodes, here is a direct reference to the link:
A.sequence:
B.selector:
C.parallel
Test the parallel node here:
Test One:
Test Two:
1. The life cycle of the behavior tree
In general, the life cycle of a tree is over when there are no nodes that can continue to execute.
A. Set the float variable num with a value of 0. The following logic is that if NUM is greater than 0, the output is "greater than 0", otherwise the output is "less than or equal to 0". This tree executes only once.
B.repeater node Tick repeat forever, the tree will continue to execute once it has been executed again.
C. Change the NUM value to 1, increase the action node, and return to running. This behavior tree will then be stuck in the action node and will not continue executing the other nodes, and the life cycle will not end.
D. Because the action node returns running, the behavior tree has not been executed, the Repeater node does not work, and the conditional node executes only once.
[Unity plugin] AI Behavior Tree Usage Summary