示例#1
0
        private void Arbitrate()
        {
            int count = this._evaluators.Count;

            if (count == 0)
            {
                return;
            }

            float         best          = 0;
            GoalEvaluator mostDesirable = null;

            for (int i = 0; i < count; i++)
            {
                GoalEvaluator evaluator    = this._evaluators[i];
                float         desirability = evaluator.CalculateDesirability();
                if (desirability > best)
                {
                    best          = desirability;
                    mostDesirable = evaluator;
                }
            }

            mostDesirable?.SetGoal();
        }
示例#2
0
    public void ChoiceGoalFromEvaluator(Brain brain)
    {
        GoalEvaluator goalEvaluator = null;
        float         num           = 0f;
        int           i             = 0;

        for (int count = evaluators.Count; i < count; i++)
        {
            GoalEvaluator goalEvaluator2 = evaluators[i];
            if (FlagIsOn((EVAL_FLAG)(1 << i)))
            {
                float num2 = goalEvaluator2.CalcEvaluateValue(brain);
                if (num2 > num)
                {
                    num           = num2;
                    goalEvaluator = goalEvaluator2;
                }
            }
        }
        if (goalEvaluator != null)
        {
            goalEvaluator.SetGoal(brain, this);
        }
        else if (GetCountSubGoal() <= 0)
        {
            AddGoal_Stop();
        }
    }
示例#3
0
        public void Arbitrate()
        {
            double best = 0;

            MostDesirable = null;

            for (int i = 0; i < Evaluators.Count; i++)
            {
                double desire = Evaluators[i].CalculateDesirability(Owner);

                if (desire >= best)
                {
                    best          = desire;
                    MostDesirable = Evaluators[i];
                }
            }

            if (!System.Object.ReferenceEquals(MostDesirable, null))
            {
                MostDesirable.SetGoal(Owner);
            }
        }