void DefineNode() { currentNode = GetRootNode(); currentNode._Inject(_ctx); var state = currentNode.Start(); if (state != BehaviourNode <X> .State.IN_PROGRESS) { currentNode = null; Debug.LogWarning("[BehaviourTree] Execution of the tree was instantaneous"); } }
State DefineNode() { foreach (var s in _childs) { var pick = s.shouldPick(ctx); if (pick) { _currentNode = s.node; _currentNode._Inject(ctx); var state = _currentNode.Start(); return(state); } } return(State.SUCCESS); }
State ToNextNode() { while (_childs.MoveNext()) { _current = _childs.Current; _current._Inject(ctx); var state = _current.Start(); if (state == State.FAILURE) { return(CalculateState(State.FAILURE)); } else if (state == State.IN_PROGRESS) { return(State.IN_PROGRESS); } } return(CalculateState(State.SUCCESS)); }