1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
using BehaviorTreeEngine; public class NewDecoratorNode : DecoratorNode { void Awake() { // Init node properties from xml files Init(0, 0, 0, ""); // Register this mono behavior node with its distinct composite (forest, tree, node) indices BtEngine.MonoBehaviorNode.Register(forestIndex, treeIndex, nodeIndex, this); } // Use this for initialization void Start () { } // Update is called once per frame void Update () { } // Return Item1: true when done repeat; false otherwise // Return Item2: Success to execute down; Failure to call this.OnReport(Executing); Executing to notify up public override Tuple<bool, NodeStatus> OnExecute() { // Put your code here to be invoked when this node is getting executed return new Tuple<bool, NodeStatus>(true, Success); } // Parameter Status: Executing is from this.OnExecute(); Success and Failure are from child // Return: Success and Failure to report up; Executing to call this.OnExecute() public override NodeStatus OnReport(NodeStatus Status) { // Put your code here to be invoked when this node is getting reported return Success; } public override void OnConstruct() { // Put your code here to be invoked when this node is getting loaded } public override void OnDestruct() { // Put your code here to be invoked when this node is getting destroyed } public override void OnReset() { // Put your code here to be invoked when this node is getting reset } public override void OnPause() { // Put your code here to be invoked when this node is getting paused } public override void OnStop() { // Put your code here to be invoked when this node is getting stopped } } |
Copyright © 2016-2020 Qualgame, LLC