// Use this for initialization void Start() { start = startObject.transform.position; goal = goalObject.transform.position; startState = new FringePlanningState(start); goalState = new FringePlanningState(goal); outputPlan = new Stack <DefaultAction>(); planner = new FringeSearchPlanner(400); planner.Cache = new Dictionary <DefaultState, FringeSearchNode>(planner._capacity); initCache(ref planner.Cache); domainList = new List <PlanningDomainBase>(); FringePlanningDomain domain = new FringePlanningDomain(); domain.setBoundaries(xmin, xmax, zmin, zmax); domainList.Add(domain); planner.init(ref domainList, -1); DefaultState DcurrentState = startState as DefaultState; DefaultState DgoalState = goalState as DefaultState; bool planComputed = planner.computePlan(ref DcurrentState, ref DgoalState, ref outputPlan, -1); Debug.Log(planComputed); Debug.Log(outputPlan.Count); st = new Stack <FringePlanningAction>(); while (outputPlan.Count != 0) { st.Push(outputPlan.Pop() as FringePlanningAction); } Debug.Log(st.Count); }
// Use this for initialization void Start() { start = startObject.transform.position; goal = goalObject.transform.position; startState = new FringePlanningState(start); goalState = new FringePlanningState(goal); outputPlan = new Stack<DefaultAction>(); planner = new FringeSearchPlanner(400); planner.Cache = new Dictionary<DefaultState, FringeSearchNode>(planner._capacity); initCache(ref planner.Cache); domainList = new List<PlanningDomainBase>(); FringePlanningDomain domain = new FringePlanningDomain(); domain.setBoundaries(xmin,xmax,zmin,zmax); domainList.Add(domain); planner.init( ref domainList, -1); DefaultState DcurrentState = startState as DefaultState; DefaultState DgoalState = goalState as DefaultState; bool planComputed = planner.computePlan(ref DcurrentState, ref DgoalState, ref outputPlan, -1); Debug.Log(planComputed); Debug.Log(outputPlan.Count); st = new Stack<FringePlanningAction>(); while(outputPlan.Count != 0) { st.Push(outputPlan.Pop() as FringePlanningAction); } Debug.Log(st.Count); }