public virtual BTNodeState Run(T obj) { Enter(obj); mNodeState = Process(obj); Leave(obj); return(mNodeState); }
protected override BTNodeState Handle() { BTNodeState result = BTNodeState.Running; int count = 0; foreach (BehaviourTreeNode node in mChildren) { if (((IBTParallelFunc)node).NodeStatus() == BTNodeState.Success) { result = BTNodeState.Success; break; } else if (((IBTParallelFunc)node).NodeStatus() == BTNodeState.Running) { continue; } else if (((IBTParallelFunc)node).NodeStatus() == BTNodeState.Failure) { count++; } } if (count == mChildren.Count) { result = BTNodeState.Failure; } return(result); }
public override BTNodeState Evaluate(BehaviourController controller) { bool nodeRunning = false; foreach (BTNode node in nodes) { BTNodeState currentNodeState = node.Evaluate(controller); switch (currentNodeState) { case BTNodeState.SUCCESS: continue; case BTNodeState.RUNNING: nodeRunning = true; continue; case BTNodeState.FAILURE: return(currentNodeState); default: break; } } return(nodeRunning? BTNodeState.RUNNING : BTNodeState.SUCCESS); }
public BTNode(int nodeId, BehaviourTree tree, BTNode parent) { _nodeId = nodeId; _tree = tree; _parent = parent; _state = BTNodeState.SUCCESS; }
public override BTNodeState start() { BTNodeState result = mNodeFunction(); if (result == BTNodeState.Running) { return(BTNodeState.Error); } return(result); }
public override BTNodeState Evaluate(BehaviourController controller) { foreach (BTNode node in nodes) { BTNodeState currentNodeState = node.Evaluate(controller); switch (currentNodeState) { case BTNodeState.SUCCESS: return(currentNodeState); case BTNodeState.FAILURE: continue; default: break; } } return(BTNodeState.FAILURE); }
public override BTNodeState Process(Target obj) { BTNodeState state = LeftOperation.Process(obj); if (RangeBoolean == BTConditionBoolean.AND) { if (state == BTNodeState.Success) { state = RightOperation.Process(obj); } } else if (RangeBoolean == BTConditionBoolean.OR) { if (state == BTNodeState.Failure) { state = RightOperation.Process(obj); } } return(state); }
protected virtual void Fail() { _state = BTNodeState.FAILURE; Finish(); }
protected virtual void Succeed() { _state = BTNodeState.SUCCESS; Finish(); }
public BehaviourTreeNode() { mRunningNode = null; mNodeState = BTNodeState.Ready; }
public BehaviourTreeNode() { mNodeState = BTNodeState.Ready; }