void Start() { // Create a copy of the behaviour tree so we can indivudually set values behaviourTree = (BehaviourTree)behaviourTree.Copy(); XNode.Node entry = ((BehaviourTree)behaviourTree.Copy()).FindEntryNode(); behaviourTreeRoot = (BehaviourNode)entry.GetOutputPort("child").GetConnection(0).node; behaviourTreeRoot.Reset(); }
public override NodeStatus OnBehave(Context context, GameObject peep) { // this wacky looking thing makes sure that our condition is a one shot and // doesn't disable after if (conditionMet) { return(GetConditionNode().Behave(context, peep)); } conditionMet = WaitCondition(context); if (conditionMet) { conditionNode.Reset(); return(GetConditionNode().Behave(context, peep)); } else { GetWaitNode().Behave(context, peep); return(NodeStatus.RUNNING); } }