コード例 #1
0
ファイル: Assignment.cs プロジェクト: XyzalZhang/behaviac
        public static bool EvaluteAssignment(Agent pAgent, Property opl, Property opr, behaviac.CMethodBase opr_m)
        {
            bool bValid = false;

            if (opl != null)
            {
                if (opr_m != null)
                {
                    object returnValue = opr_m.Invoke(pAgent);

                    Agent pParentOpl = opl.GetParentAgent(pAgent);
                    opl.SetValue(pParentOpl, returnValue);

                    bValid = true;
                }
                else if (opr != null)
                {
                    Agent pParentL = opl.GetParentAgent(pAgent);
                    Agent pParentR = opr.GetParentAgent(pAgent);

                    opl.SetFrom(pParentR, opr, pParentL);

                    bValid = true;
                }
            }

            return bValid;
        }
コード例 #2
0
        public static bool EvaluteCompute(Agent pAgent, Property opl, Property opr1, CMethodBase opr1_m, EComputeOperator opr, Property opr2, CMethodBase opr2_m)
        {
            bool bValid = false;
            object value1 = null;

            if (opl != null)
            {
                if (opr1_m != null)
                {
                    bValid = true;
                    value1 = opr1_m.Invoke(pAgent);
                }
                else if (opr1 != null)
                {
                    bValid = true;
                    Agent pParentR = opr1.GetParentAgent(pAgent);

                    value1 = opr1.GetValue(pParentR);
                }

                if (opr2_m != null)
                {
                    bValid = true;
                    object value2 = opr2_m.Invoke(pAgent);

                    Agent pParentOpl = opl.GetParentAgent(pAgent);
                    object returnValue = Details.ComputeValue(value1, value2, opr);

                    opl.SetValue(pParentOpl, returnValue);
                }
                else if (opr2 != null)
                {
                    bValid = true;
                    Agent pParentL = opl.GetParentAgent(pAgent);
                    Agent pParentR = opr2.GetParentAgent(pAgent);

                    object value2 = opr2.GetValue(pParentR);

                    object returnValue = Details.ComputeValue(value1, value2, opr);

                    opl.SetValue(pParentL, returnValue);
                }
            }

            return bValid;
        }
コード例 #3
0
ファイル: Compute.cs プロジェクト: XyzalZhang/behaviac
        public static bool EvaluteCompute(Agent pAgent, Property opl, Property opr1, CMethodBase opr1_m, EComputeOperator opr, Property opr2, CMethodBase opr2_m)
        {
            bool bValid = false;
            object value1 = null;

            if (opl != null)
            {
            if (opr1_m != null)
            {
                bValid = true;
                value1 = opr1_m.Invoke(pAgent);
            }
            else if (opr1 != null)
            {
                bValid = true;
                Agent pParentR = opr1.GetParentAgent(pAgent);

                value1 = opr1.GetValue(pParentR);
            }

            Debug.Check(value1 != null, "weird, have you modified your meta? please reexport your trees");

            if (opr2_m != null)
            {
                bValid = true;
                object value2 = opr2_m.Invoke(pAgent);

                Agent pParentOpl = opl.GetParentAgent(pAgent);
                object returnValue = Details.ComputeValue(value1, value2, opr);

                opl.SetValue(pParentOpl, returnValue);
            }
            else if (opr2 != null)
            {
                bValid = true;
                Agent pParentL = opl.GetParentAgent(pAgent);
                Agent pParentR = opr2.GetParentAgent(pAgent);

                object value2 = opr2.GetValue(pParentR);

                object returnValue = Details.ComputeValue(value1, value2, opr);

                opl.SetValue(pParentL, returnValue);
            }
            }

            return bValid;
        }