예제 #1
0
 public Parallel()
 {
     this.m_failPolicy        = FAILURE_POLICY.FAIL_ON_ONE;
     this.m_succeedPolicy     = SUCCESS_POLICY.SUCCEED_ON_ALL;
     this.m_exitPolicy        = EXIT_POLICY.EXIT_NONE;
     this.m_childFinishPolicy = CHILDFINISH_POLICY.CHILDFINISH_LOOP;
 }
예제 #2
0
 private void SetPolicy(FAILURE_POLICY failPolicy /*= FAILURE_POLICY.FAIL_ON_ALL*/,
                        SUCCESS_POLICY successPolicy /*= SUCCESS_POLICY.SUCCEED_ON_ALL*/,
                        EXIT_POLICY exitPolicty /*= EXIT_POLICY.EXIT_NONE*/)
 {
     m_failPolicy    = failPolicy;
     m_succeedPolicy = successPolicy;
     m_exitPolicy    = exitPolicty;
 }
예제 #3
0
 protected override void load(int version, string agentType, List <property_t> properties)
 {
     base.load(version, agentType, properties);
     for (int i = 0; i < properties.get_Count(); i++)
     {
         property_t property_t = properties.get_Item(i);
         if (property_t.name == "FailurePolicy")
         {
             if (property_t.value == "FAIL_ON_ONE")
             {
                 this.m_failPolicy = FAILURE_POLICY.FAIL_ON_ONE;
             }
             else if (property_t.value == "FAIL_ON_ALL")
             {
                 this.m_failPolicy = FAILURE_POLICY.FAIL_ON_ALL;
             }
         }
         else if (property_t.name == "SuccessPolicy")
         {
             if (property_t.value == "SUCCEED_ON_ONE")
             {
                 this.m_succeedPolicy = SUCCESS_POLICY.SUCCEED_ON_ONE;
             }
             else if (property_t.value == "SUCCEED_ON_ALL")
             {
                 this.m_succeedPolicy = SUCCESS_POLICY.SUCCEED_ON_ALL;
             }
         }
         else if (property_t.name == "ExitPolicy")
         {
             if (property_t.value == "EXIT_NONE")
             {
                 this.m_exitPolicy = EXIT_POLICY.EXIT_NONE;
             }
             else if (property_t.value == "EXIT_ABORT_RUNNINGSIBLINGS")
             {
                 this.m_exitPolicy = EXIT_POLICY.EXIT_ABORT_RUNNINGSIBLINGS;
             }
         }
         else if (property_t.name == "ChildFinishPolicy")
         {
             if (property_t.value == "CHILDFINISH_ONCE")
             {
                 this.m_childFinishPolicy = CHILDFINISH_POLICY.CHILDFINISH_ONCE;
             }
             else if (property_t.value == "CHILDFINISH_LOOP")
             {
                 this.m_childFinishPolicy = CHILDFINISH_POLICY.CHILDFINISH_LOOP;
             }
         }
     }
 }
예제 #4
0
        public ParallelBT(FAILURE_POLICY failurePolicy, SUCCESS_POLICY successPolicy)
        {
            me_FailurePolicy = (int) failurePolicy;
            me_SuccessPolicy = (int) successPolicy;

            ml_FailPolicyCheck =  new List<Func<STATUS>>();
            ml_FailPolicyCheck.Add(FailOnOneCheck);
            ml_FailPolicyCheck.Add(FailOnAllCheck);

            ml_SuccessPolicyCheck = new List<Func<STATUS>>();
            ml_SuccessPolicyCheck.Add(SuccessOnOneCheck);
            ml_SuccessPolicyCheck.Add(SuccessOnAllCheck);
        }
예제 #5
0
        //--------------------------------------------------
        // Accessors
        //--------------------------------------------------

        #region ACCESSORS
        #endregion

        //--------------------------------------------------
        // Constructors
        //--------------------------------------------------

        #region CONSTRUCTORS
        public ParallelBT(FAILURE_POLICY failurePolicy, SUCCESS_POLICY successPolicy)
        {
            me_FailurePolicy = (int)failurePolicy;
            me_SuccessPolicy = (int)successPolicy;

            ml_FailPolicyCheck = new List <Func <STATUS> >();
            ml_FailPolicyCheck.Add(FailOnOneCheck);
            ml_FailPolicyCheck.Add(FailOnAllCheck);

            ml_SuccessPolicyCheck = new List <Func <STATUS> >();
            ml_SuccessPolicyCheck.Add(SuccessOnOneCheck);
            ml_SuccessPolicyCheck.Add(SuccessOnAllCheck);
        }
예제 #6
0
        public override void OnAwake()
        {
            EnumField successPolicy = NodeData["SuccessType"] as EnumField;
            EnumField failedPolicy  = NodeData["FailType"] as EnumField;

            if (successPolicy == null || failedPolicy == null)
            {
                Node.Status = ENodeStatus.Error;
                return;
            }

            m_SuccessPolicy = (SUCCESS_POLICY)successPolicy.Value;
            m_FailurePolicy = (FAILURE_POLICY)failedPolicy.Value;

            m_CompositeNode = Node as CompositeNode;
        }
예제 #7
0
파일: Parallel.cs 프로젝트: pjkui/behaviac
 private void SetPolicy(FAILURE_POLICY failPolicy /*= FAILURE_POLICY.FAIL_ON_ALL*/,
                        SUCCESS_POLICY successPolicy /*= SUCCESS_POLICY.SUCCEED_ON_ALL*/,
                        EXIT_POLICY exitPolicty /*= EXIT_POLICY.EXIT_NONE*/)
 {
     m_failPolicy = failPolicy;
     m_succeedPolicy = successPolicy;
     m_exitPolicy = exitPolicty;
 }
예제 #8
0
 public Parallel()
 {
     m_failPolicy = FAILURE_POLICY.FAIL_ON_ONE;
     m_succeedPolicy = SUCCESS_POLICY.SUCCEED_ON_ALL;
     m_exitPolicy = EXIT_POLICY.EXIT_NONE;
     m_childFinishPolicy = CHILDFINISH_POLICY.CHILDFINISH_LOOP;
 }
예제 #9
0
        protected override void load(int version, string agentType, List<property_t> properties)
        {
            base.load(version, agentType, properties);

            for (int i = 0; i < properties.Count; ++i)
            {
                property_t p = properties[i];

                if (p.name == "FailurePolicy")
                {
                    if (p.value == "FAIL_ON_ONE")
                    {
                        this.m_failPolicy = FAILURE_POLICY.FAIL_ON_ONE;
                    }
                    else if (p.value == "FAIL_ON_ALL")
                    {
                        this.m_failPolicy = FAILURE_POLICY.FAIL_ON_ALL;
                    }
                    else
                    {
                        Debug.Check(false);
                    }
                }
                else if (p.name == "SuccessPolicy")
                {
                    if (p.value == "SUCCEED_ON_ONE")
                    {
                        this.m_succeedPolicy = SUCCESS_POLICY.SUCCEED_ON_ONE;
                    }
                    else if (p.value == "SUCCEED_ON_ALL")
                    {
                        this.m_succeedPolicy = SUCCESS_POLICY.SUCCEED_ON_ALL;
                    }
                    else
                    {
                        Debug.Check(false);
                    }
                }
                else if (p.name == "ExitPolicy")
                {
                    if (p.value == "EXIT_NONE")
                    {
                        this.m_exitPolicy = EXIT_POLICY.EXIT_NONE;
                    }
                    else if (p.value == "EXIT_ABORT_RUNNINGSIBLINGS")
                    {
                        this.m_exitPolicy = EXIT_POLICY.EXIT_ABORT_RUNNINGSIBLINGS;
                    }
                    else
                    {
                        Debug.Check(false);
                    }
                }
                else if (p.name == "ChildFinishPolicy")
                {
                    if (p.value == "CHILDFINISH_ONCE")
                    {
                        this.m_childFinishPolicy = CHILDFINISH_POLICY.CHILDFINISH_ONCE;
                    }
                    else if (p.value == "CHILDFINISH_LOOP")
                    {
                        this.m_childFinishPolicy = CHILDFINISH_POLICY.CHILDFINISH_LOOP;
                    }
                    else
                    {
                        Debug.Check(false);
                    }
                }
                else
                {
                    // todo: enter exit action failed here by mistake
                    //Debug.Check(false);
                }
            }
        }