コード例 #1
0
        protected override IEnumerator process(BehaviourTreeAgent agent)
        {
            BehaviourTreeNodeState myState = stateForAgent(agent);

            foreach (ConnectionPort knob in outputPorts)
            {
                if (knob.connected())
                {
                    BehaviourTreeNode      node       = knob.connection(0).body as BehaviourTreeNode;
                    BehaviourTreeNodeState childState = node.stateForAgent(agent);
                    yield return(agent.StartCoroutine(node.routine(childState)));

                    if (childState.actualCondition == processCondition.Sucess)
                    {
                        myState.actualCondition = processCondition.Sucess;
                    }
                    if (myState.actualCondition == processCondition.Sucess)
                    {
                        yield break;
                    }
                }
            }
            if (myState.actualCondition == processCondition.Running)
            {
                myState.actualCondition = processCondition.Failure;
            }
        }
コード例 #2
0
        protected override IEnumerator process(BehaviourTreeAgent agent)
        {
            BehaviourTreeNodeState state      = stateForAgent(agent);
            BehaviourTreeNode      child      = outputKnob.connection(0).body as BehaviourTreeNode;
            BehaviourTreeNodeState childState = child.stateForAgent(agent);

            yield return(agent.StartCoroutine(child.routine(childState)));

            state.actualCondition = processCondition.Sucess;
        }
コード例 #3
0
        protected override IEnumerator process(BehaviourTreeAgent agent)
        {
            actualRepetition = 0;
            BehaviourTreeNodeState state      = stateForAgent(agent);
            BehaviourTreeNode      child      = outputKnob.connection(0).body as BehaviourTreeNode;
            BehaviourTreeNodeState childState = child.stateForAgent(agent);

            while (repeatForever || actualRepetition < repetitionQuantity)
            {
                yield return(agent.StartCoroutine(child.routine(childState)));

                actualRepetition++;
            }
            state.actualCondition = childState.actualCondition;
        }
コード例 #4
0
        protected override IEnumerator process(BehaviourTreeAgent agent)
        {
            actualRepetition = 0;
            BehaviourTreeNodeState state      = stateForAgent(agent);
            BehaviourTreeNode      child      = outputKnob.connection(0).body as BehaviourTreeNode;
            BehaviourTreeNodeState childState = child.stateForAgent(agent);

            do
            {
                yield return(agent.StartCoroutine(child.routine(childState)));

                actualRepetition++;
            } while ((repeatForever || actualRepetition < repetitionQuantity) && childState.actualCondition != processCondition.Failure);
            if (childState.actualCondition == processCondition.Failure)
            {
                state.actualCondition = processCondition.Sucess;
            }
            if (childState.actualCondition == processCondition.Sucess)
            {
                state.actualCondition = processCondition.Failure;
            }
        }
コード例 #5
0
        void StartThinking()
        {
            BehaviourTreeNodeState rootState = nodes.Where(x => x.node == root).First();

            coroutine = StartCoroutine(root.routine(rootState));
        }