private BehaviourTree.Status SequenceTick() { foreach (BehaviourTreeNode child in children) { if (this.startFromFirstNodeEachTick || this.currentTickedNode == null || this.currentTickedNode == child) { BehaviourTree.Status childStatus = child.Tick(); if (childStatus == BehaviourTree.Status.RUNNING) { this.currentTickedNode = child; return(childStatus); } if (childStatus == BehaviourTree.Status.FAILURE) { this.currentTickedNode = null; return(childStatus); } } } this.currentTickedNode = null; return(BehaviourTree.Status.SUCCESS); }
private BehaviourTree.Status IgnoreFailureTick() { BehaviourTree.Status result = child.Tick(); if (result == BehaviourTree.Status.FAILURE) { return(BehaviourTree.Status.RUNNING); } return(result); }
private BehaviourTree.Status IgnoreSuccessTick() { BehaviourTree.Status result = child.Tick(); if (result == BehaviourTree.Status.SUCCESS) { return(BehaviourTree.Status.RUNNING); } return(result); }
private BehaviourTree.Status InverterTick() { BehaviourTree.Status result = child.Tick(); if (result == BehaviourTree.Status.SUCCESS) { return(BehaviourTree.Status.FAILURE); } if (result == BehaviourTree.Status.FAILURE) { return(BehaviourTree.Status.SUCCESS); } return(BehaviourTree.Status.RUNNING); }
private BehaviourTree.Status ParallelTick() { bool firstChild = true; foreach (BehaviourTreeNode child in children) { if (firstChild) { firstChild = false; BehaviourTree.Status firstChildStatus = child.Tick(); if (firstChildStatus != BehaviourTree.Status.RUNNING) { return(firstChildStatus); } } else { child.Tick(); } } return(BehaviourTree.Status.RUNNING); }