public void getNearbyFeatures(int directionCode) { Vector2d currentLocation = getLongLat(); double latitude = currentLocation.x; double longitude = currentLocation.y; string infoPanelString = ""; string readableString = ""; string singleReadableString = ""; int x = 1; int totalFeatureCount = 3; int featureCount = 0; string headerText = ""; double searchRadius = ((double)PlayerPrefs.GetInt("SearchRadius", 5000)) / 1000; List <BingMapsClasses.Result> newResultsList = BingMapsClasses.requestPoiFromBingMaps(latitude, longitude, searchRadius, 10); //limitation due to Bing Search API : Allows only 3 calls per second foreach (BingMapsClasses.Result result in newResultsList) { //Gather Data about point // 1. Gather positional data double resultLong = result.Longitude; double resultLat = result.Latitude; Vector3 unityPos = getUnityPos(resultLat, resultLong); double distanceFromPlayerM = DistanceCalculator.getDistanceBetweenPlaces(longitude, latitude, resultLong, resultLat) * 1000; float relativeAngle = getRelativeDirection(unityPos); string relativeDirectionString = DistanceCalculator.getRelativeDirectionString(relativeAngle); //sets up filter for get ahead based on direction if (directionCode == (int)DirFilter.AHEAD) { Debug.Log("Getting Ahead of Me"); if (!(relativeAngle > -60.0f && relativeAngle < 60.0f)) { continue; } } // 2. Gather Display characteristics string displayName = result.DisplayName;; string rawUrl = bsHandler.getLinkResult(displayName); string additionalInfoUrl = string.Format("<link=\"{0}\"><color=yellow>{1}</color></link>", rawUrl, "Display Text"); //Construct Strings after validation //To be displayed on info panel infoPanelString = ("<color=yellow>" + displayName + "</color>" + "\n" + result.AddressLine + "\n" + BingMapsEntityId.getEntityNameFromId(result.EntityTypeID)); infoPanelString = string.Format("<link=\"{0}\">{1}</link>", rawUrl, infoPanelString); //To be read by TTS Handler singleReadableString = displayName + " , " + result.AddressLine + " , " + BingMapsEntityId.getEntityNameFromId(result.EntityTypeID) + " , " + relativeDirectionString; //Get Relevant panel and text box: Transform relavantPoiPanel = infoPanelMap [x]; TextMeshProUGUI relavantTextMesh = relavantPoiPanel.Find("POI Info").GetComponent <TextMeshProUGUI> (); relavantTextMesh.text = infoPanelString; poiPanel gotoButton = relavantPoiPanel.GetComponent <poiPanel>(); gotoButton.setSendLocation(unityPos); gotoButton.coordinateX = resultLat; gotoButton.coordinateY = resultLong; StartCoroutine(ttsHandler.GetTextToSpeech(singleReadableString, featureCount, unityPos, true)); x++; featureCount++; if (featureCount == totalFeatureCount) { break; } } infoHeaderTextMesh.text = getHeaderText(directionCode); infoPanel.SetActive(true); Debug.Log("THIS PLAYER IS AT: " + getUnityPos(currentLocation.x, currentLocation.y).ToString()); ttsHandler.StartCoroutine(ttsHandler.playDirAudioQueue(featureCount)); }
public void firstClick() { StartCoroutine(ttsHandler.GetTextToSpeech(buttonText, 0, Vector3.zero, false)); buttonSelector.setLastClickedId(buttonID); }