public GoapPlannerThread(AutoResetEvent threadEvents, ReGoapPlannerSettings plannerSettings, Queue <PlanWork> worksQueue, Action <GoapPlannerThread, PlanWork, IReGoapGoal> onDonePlan) { this.threadEvents = threadEvents; planner = new ReGoapPlanner(plannerSettings); this.worksQueue = worksQueue; isRunning = true; this.onDonePlan = onDonePlan; }
public void TestImpossiblePlanDynamicActions() { var planner = new ReGoapPlanner <string, object>( new ReGoapPlannerSettings { PlanningEarlyExit = false, UsingDynamicActions = true, MaxIterations = 100, MaxNodesToExpand = 20 } ); var gameObject = new GameObject(); ReGoapTestsHelper.GetCustomAction(gameObject, "BuyFood", new Dictionary <string, object> { { "IntGold", 10 } }, new Dictionary <string, object> { { "IntGold", -10 }, { "IntFood", 1 } }, 3); ReGoapTestsHelper.GetCustomAction(gameObject, "GoMine", new Dictionary <string, object> { { "IntFood", 1 } }, new Dictionary <string, object> { { "IntGold", 5 }, { "IntFood", -1 } }, 5); ReGoapTestsHelper.GetCustomGoal(gameObject, "GetGold", new Dictionary <string, object> { { "IntGold", 30 } }); var memory = gameObject.AddComponent <ReGoapTestMemory>(); memory.Init(); memory.SetStructValue("IntGold", StructValue.CreateIntArithmetic(10)); memory.SetStructValue("IntFood", StructValue.CreateIntArithmetic(3)); var agent = gameObject.AddComponent <ReGoapTestAgent>(); agent.Init(); var plan = planner.Plan(agent, null, null, null); Assert.That(plan, Is.Null); }
public ReGoapPlannerThread(ReGoapPlannerSettings plannerSettings, Action <ReGoapPlannerThread <T, W>, ReGoapPlanWork <T, W>, IReGoapGoal <T, W> > onDonePlan) { planner = new ReGoapPlanner <T, W>(plannerSettings); this.onDonePlan = onDonePlan; }