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(); } }
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(); }
public void Rearbitrate() { this.previous = Type.Undefined; this.RemoveAllSubgoals(); int count = this._evaluators.Count; for (int i = 0; i < count; i++) { GoalEvaluator evaluator = this._evaluators[i]; evaluator.Reset(); } this._status = Status.Inactive; }
public GoalEvaluator GetEvaluator <T>() where T : GoalEvaluator { int count = this._evaluators.Count; for (int i = 0; i < count; i++) { GoalEvaluator evaluator = this._evaluators[i]; if (evaluator is T) { return(evaluator); } } return(null); }
public GoalEvaluator GetEvaluator(System.Type type) { int count = this._evaluators.Count; for (int i = 0; i < count; i++) { GoalEvaluator evaluator = this._evaluators[i]; if (evaluator.GetType() == type) { return(evaluator); } } return(null); }
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)); }
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); } }
public static List <Tile> FindPath(Tile start, GoalEvaluator isGoal, PathfindingHeuristic costHeuristic) { Path_AStar resolver = new Path_AStar(World.Current, start, isGoal, costHeuristic); return(resolver.GetList()); }
public Builder WithGoal(Goal goal, GoalEvaluator evaluator) { this.evaluators.Add(goal, evaluator); return(this); }
public void AddEvaluator(GoalEvaluator evaluator) { evaluator.brain = this; this._evaluators.Add(evaluator); }
public void AddEvaluator(GoalEvaluator <BaseSoldier> p) { Evaluators.Add(p); }
public void AddEvaluator(GoalEvaluator <NormalPeople> p) { Evaluators.Add(p); }
public void AddEvaluator(GoalEvaluator <SimWood> p) { Evaluators.Add(p); }