Esempio n. 1
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();
        }
    }
Esempio n. 2
0
    public string ToStringEvaluator(Brain brain)
    {
        string text = string.Empty + evalFlag + "\n";
        int    i    = 0;

        for (int count = evaluators.Count; i < count; i++)
        {
            GoalEvaluator goalEvaluator = evaluators[i];
            float         num           = goalEvaluator.CalcEvaluateValue(brain);
            bool          flag          = FlagIsOn((EVAL_FLAG)(1 << i));
            string        text2         = text;
            text = text2 + string.Empty + i + ((!flag) ? "(Off)" : string.Empty) + string.Empty + goalEvaluator + ": " + num + "\n";
        }
        return(text.TrimEnd(null));
    }