/// <summary> /// Implementation of <see cref="IAction"/> interface. Calls the Plan method of the <see cref="GoapPlanner"/>. /// </summary> public void Execute() { // get the world state and the goal we want to plan for var worldState = _dataProvider.GetWorldState(); var goal = _dataProvider.CreateGoalState(); // Plan var plan = _planner.Plan(_agent.gameObject, _agent.GetAvailableActions(), worldState, goal); if (plan != null)// we have a plan, hooray! { _agent.SetCurrentActions(plan); _dataProvider.PlanFound(goal, plan); } else// ugh, we couldn't get a plan { _dataProvider.PlanFailed(goal); } }