private void LoadWaypoints(Assets.Scripts.DataModel dataValue)
 {
     for (int i = 0; i < dataValue.waypoints.Length; i++)
     {
         Vector3 startPoint = transform.position;
         startPoint.y = 3.0f;
         GameObject newMarker = Instantiate(waypointMarker, startPoint, waypointMarker.transform.rotation);
         newMarker.GetComponent<MapMarker>().Setup(map, dataValue.waypoints[i]);
         waypoints.Add(newMarker);
     }
 }
Beispiel #2
0
 private void DataCallback(string inData, bool error)
 {
     Assets.Scripts.DataModel dataValue = JsonUtility.FromJson <Assets.Scripts.DataModel>(inData);
     if (dataValue == null)
     {
         // System disconnect
     }
     else
     {
         robotMarker.UpdatePosition(new Vector2d(dataValue.gps.latitude, dataValue.gps.longitude), dataValue.gps.heading);
     }
     mapControls.UpdatePanel(dataValue);
 }
 /// <summary>
 /// Updates the panel with new data
 /// </summary>
 /// <param name="dataModel"></param>
 public void UpdatePanel(Assets.Scripts.DataModel dataValue)
 {
     if (dataValue == null)
     {
         lastConnected = false;
         return;
     }
     if (!lastConnected)
     {
         Debug.Log("Load waypoints");
         LoadWaypoints(dataValue);
     }
     if (autoFollow)
     {
         map.SetCenterLatitudeLongitude(new Vector2d(dataValue.gps.latitude, dataValue.gps.longitude));
         map.UpdateMap();
     }
     lastConnected = true;
 }