/// <summary> /// Creates object of class ExperienceRoute, populates with data from API and adds it to experienceItems queue /// </summary> /// <param name="currExperience">A pointer the experience item that is added to the list of experiences</param> /// <param name="currRouteStr">The current route string from the API for this route</param> public void addRouteExperience(Experience currExperience, string currRouteStr) { int anchorCount = 0; // Parse Route, create Experience Obj ExperienceRoute currRoute = new ExperienceRoute(); currRoute.setRouteName(currRouteStr.Replace(" ", "").Split('`')[0]); // Get Comma separated list of anchors anchorCount = currRouteStr.Replace(" ", "").Split('`')[1].Replace(" ", "").Split(',').Length; List <ExperienceAnchor> tempAnchorList = new List <ExperienceAnchor>(); for (int j = 0; j < anchorCount; j++) { string currAnchorStr = currRouteStr.Split('`')[1].Replace(" ", "").Split(',')[j]; ExperienceAnchor anchor = new ExperienceAnchor(); anchor.setAnchorName(currAnchorStr.Split(':')[0]); anchor.setAnchorData(currAnchorStr.Split(':')[1]); tempAnchorList.Add(anchor); } currRoute.setAnchors(tempAnchorList); currExperience.setType("Route"); currExperience.route = currRoute; this.experienceItems.Add(currExperience); }
/// <summary> /// Ideally fetches the Route for the navigation experience and calls the function that /// leads the user through PathNav /// </summary> /// <param name="exp"></param> /// @steeve: Connect w/ Dylan to see where that functionality is and call into it. public async Task HandleRoute(ExperienceRoute exp) { // Newtonsoft.Json.Linq.JObject parsed = Newtonsoft.Json.Linq.JObject.Parse(json); // foreach (var pair in parsed) // { // Debug.Log($"{pair.Key}: {pair.Value}"); // } // Add Anchors for the route GameObject.Find("AzureSpatialAnchors").GetComponent <AzureSpatialAnchors_CombinedExperience>(). initializeAnchorKeyList(); foreach (ExperienceAnchor anchorExp in exp.getAnchors()) { GameObject.Find("AzureSpatialAnchors").GetComponent <AzureSpatialAnchors_CombinedExperience>(). addAnchorKeyToFind(anchorExp.getAnchorData()); } GameObject.Find("AzureSpatialAnchors").GetComponent <AzureSpatialAnchors_CombinedExperience>().setNbrOfDestAnchors(exp.getAnchors().Count); // Run await GameObject.Find("AzureSpatialAnchors").GetComponent <AzureSpatialAnchors_CombinedExperience>(). searchAndBeginNav(); }