Ejemplo n.º 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;
            }
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 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;
            }
        }