private List <IGOAPReadOnlyAction> GetGOAPPlan(Scholar scholar, string goalKey) { var context = new GOAPStateContext(scholar.GoapContext, scholar.ClassRoom.GoapContext); var comparer = new BaseCostComparer(); var planner = new GOAPPlanner(context, comparer); List <IGOAPReadOnlyAction> plan; if (!planner.TryGetBestPlan(GOAPGoalsManager.Instance.Goals[goalKey], out plan)) { throw new Exception($"{scholar} не нашел план для цели \"{goalKey}\""); } return(plan); }
public static void ConstructBest(string goalKey) { var context = new GOAPStateContext(GOAPConxtextFactory.ScholarContext, GOAPConxtextFactory.ClassContext); var comparer = new BaseCostComparer(); var planer = new GOAPPlanner(context, comparer); if (!planer.TryGetBestPlan(GOAPGoalsManager.Instance.Goals[goalKey], out var plan)) { throw new Exception("Мы проебались!"); } Console.ForegroundColor = ConsoleColor.Magenta; GOAPConsoleWriter.WritePlan(plan); Console.ResetColor(); }