void OnDestroy() { if (_root != null) { _root.Clear(); } }
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()); } }
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); }