public override IReGoapActionSettings <string, object> GetSettings(IReGoapAgent <string, object> goapAgent, ReGoapState <string, object> goalState) { var newNeededResourceName = GetNeededResourceFromGoal(goalState); GatherResourceSettings wantedSettings = null; if (newNeededResourceName != null) { var wantedResource = agent.GetMemory().GetWorldState().Get("nearest" + newNeededResourceName) as IResource; if (wantedResource != null) { wantedSettings = new GatherResourceSettings { ResourcePosition = (Vector3)agent.GetMemory().GetWorldState() .Get(string.Format("nearest{0}Position", newNeededResourceName)), Resource = wantedResource }; } } return(wantedSettings); }
public override IReGoapActionSettings GetSettings(ReGoapState goalState) { var newNeededResourceName = GetNeededResourceFromGoal(goalState); GatherResourceSettings wantedSettings = null; if (newNeededResourceName != null) { ReGoapState reGoapState = reGoapAgent.GetWorldState(); Resource wantedResource = reGoapState.Get("nearest" + newNeededResourceName) as Resource; if (wantedResource != null) { wantedSettings = new GatherResourceSettings { ResourcePosition = (Vector3)reGoapState.Get(string.Format("nearest{0}Position", newNeededResourceName)), Resource = wantedResource }; } } return(wantedSettings); }