예제 #1
0
            public bool Execute(Agent pAgent)
            {
                bool bValid = false;

                // action
                if (this.m_opl_m != null && this.m_operator == EOperatorType.E_INVALID)
                {
                    bValid = true;
                    this.m_opl_m.Invoke(pAgent);
                }

                // assign
                else if (this.m_operator == EOperatorType.E_ASSIGN)
                {
                    bValid = Assignment.EvaluteAssignment(pAgent, this.m_opl, this.m_opr2, this.m_opr2_m);
                }

                // compute
                else if (this.m_operator >= EOperatorType.E_ADD && this.m_operator <= EOperatorType.E_DIV)
                {
                    EComputeOperator computeOperator = (EComputeOperator)(EComputeOperator.E_ADD + (this.m_operator - EOperatorType.E_ADD));
                    bValid = Compute.EvaluteCompute(pAgent, this.m_opl, this.m_opr1, this.m_opr1_m, computeOperator, this.m_opr2, this.m_opr2_m);
                }

                // compare
                else if (this.m_operator >= EOperatorType.E_EQUAL && this.m_operator <= EOperatorType.E_LESSEQUAL)
                {
                    if (this.m_comparator != null)
                    {
                        bValid = this.m_comparator.Execute(pAgent);
                    }
                }

                return(bValid);
            }
예제 #2
0
            protected override EBTStatus update(Agent pAgent, EBTStatus childStatus)
            {
                Debug.Check(childStatus == EBTStatus.BT_RUNNING);

                EBTStatus result = EBTStatus.BT_SUCCESS;

                Debug.Check(this.GetNode() is Compute);
                Compute pComputeNode = (Compute)(this.GetNode());

                bool bValid = Compute.EvaluteCompute(pAgent, pComputeNode.m_opl, pComputeNode.m_opr1, pComputeNode.m_opr1_m,
                                                     pComputeNode.m_operator, pComputeNode.m_opr2, pComputeNode.m_opr2_m);

                if (!bValid)
                {
                    result = pComputeNode.update_impl(pAgent, childStatus);
                }

                return(result);
            }