protected override bool DoEvaluate() { int numActiveChildren = 0; for (int i = 0; i < children.Count; i++) { BTNode child = children[i]; if (child.Evaluate()) { _activeList[i] = true; numActiveChildren++; } else { _activeList[i] = false; } } if (numActiveChildren == 0) { return(false); } return(true); }
protected override bool DoEvaluate() { for (int i = 0; i < children.Count; ++i) { BTNode child = children[i]; if (!child.Evaluate()) { return(false); } } return(true); }
protected override bool DoEvaluate() { if (_activeChild != null) { bool result = _activeChild.Evaluate(); if (!result) { _activeChild.Clear(); _activeChild = null; _activeIndex = -1; } return(result); } else { return(children[0].Evaluate()); } }
public void DoUpdate() { if (!isRunning) { return; } //if(++frameCount>=framePeriod) { // frameCount = 0; // if (database.GetData<bool>(RESET)) // { // Reset(); // database.SetData<bool>(RESET, false); // } // Iterate the BT tree now! if (_root.Evaluate()) { _root.Tick(); } } }
protected override bool DoEvaluate() { for (int i = 0; i < children.Count; ++i) { BTNode child = children[i]; if (child.Evaluate()) { if (_activeChild != null && _activeChild != child) { _activeChild.Clear(); } _activeChild = child; return(true); } } if (_activeChild != null) { _activeChild.Clear(); _activeChild = null; } return(false); }