protected override bool EvaluateThenExecuteInner(object input) { if (this.numChildren == 0) { return(false); } System.Random random = new System.Random(); int currentChildNodeIndex = random.Next() % this.numChildren; BehaviourNode behaviourNode = this.children[currentChildNodeIndex]; return(behaviourNode != null && behaviourNode.enabled && behaviourNode.EvaluateThenExecute(input)); }
protected override bool EvaluateThenExecuteInner(object input) { if (this.numChildren == 0) { return(false); } for (int i = 0; i < this.numChildren; ++i) { BehaviourNode behaviourNode = this.children[i]; if (behaviourNode != null && behaviourNode.enabled) { behaviourNode.EvaluateThenExecute(input); } } return(true); }
protected override bool EvaluateThenExecuteInner(object input) { if (this.numChildren == 0) { return(false); } ++this.currentChildNodeIndex; if (this.currentChildNodeIndex >= this.numChildren) { this.currentChildNodeIndex = 0; } if (this.IsLegalChildNodeIndex(this.currentChildNodeIndex)) { BehaviourNode behaviourNode = this.children[this.currentChildNodeIndex]; if (behaviourNode != null && behaviourNode.enabled && behaviourNode.EvaluateThenExecute(input)) { return(true); } } return(false); }