Beispiel #1
0
    // Callback from Foursquare call
    private void OnVenueDataReceived(List <FoursquareAPI.Venue> venues)
    {
        if (venues != null)
        {
            PoiDataProvider poiData = _curPoiBuilding.AddComponent <PoiDataProvider>();
            poiData.Venues = venues;
            //poiData.RaycastedPoint = _curPoiWorldPoint;

            //CreateVectorLocationData(poiData);
            DisplayClosestPoi(poiData, _curPoiWorldPoint);

            _gettingFoursquareData = false;

            // Debugging
            //Instantiate(RaycastHitPoint, _curPoiWorldPoint, Quaternion.identity);
        }
    }
Beispiel #2
0
    private void DisplayClosestPoi(PoiDataProvider poiData, Vector3 raycastPoint)
    {
        int   closestVenueIndex = 0;
        float shortestDist      = Vector3.Distance(raycastPoint, poiData.Venues[0].unityCoord);

        for (int i = 1; i < poiData.Venues.Count; i++)
        {
            float venueDist = Vector3.Distance(raycastPoint, poiData.Venues[i].unityCoord);
            if (venueDist < shortestDist)
            {
                closestVenueIndex = i;
                shortestDist      = venueDist;
            }
        }

        PoiText.text = poiData.Venues[closestVenueIndex].name;
        PoiCastPointVisual.position = _curPoiScreenPoint;
        PoiCastPointVisual.gameObject.SetActive(true);
    }