public void DecideGoalBehavior() { lastBehaviorDecision = GameTimer.Instance.GetFrameTimestamp(); IReadonlyListX <DecisionContext> goalContexts = activeGoal.GetExecutionContexts(entity); float maxScore = float.MinValue; activeContext = null; activeBehavior = null; for (int i = 0; i < behaviors.Count; i++) { AIBehavior behavior = behaviors[i]; if (!behavior.CanSatisfyGoalType(activeGoal.goalType)) { // continue; } DecisionContext context; float score = AIUtil.Score(goalContexts, behavior.considerations, maxScore, out context); if (score > maxScore) { maxScore = score; activeBehavior = behavior; activeContext = context; } } }