void OnGUI() { EditorGUILayout.LabelField("Latitude", latitude.ToString()); EditorGUILayout.LabelField("Longitude", longitude.ToString()); moveFoldOut = EditorGUILayout.Foldout(moveFoldOut, "Move to GPS Position"); if(moveFoldOut) { latitudeDegree = EditorGUILayout.IntField("Latitude Degree", latitudeDegree); latitudeMinute = EditorGUILayout.IntField("Latitude Minute", latitudeMinute); latitudeSecond = EditorGUILayout.FloatField("Latitude Second", latitudeSecond); longitudeDegree = EditorGUILayout.IntField("Longitude Degree", longitudeDegree); longitudeMinute = EditorGUILayout.IntField("Longitude Minute", longitudeMinute); longitudeSecond = EditorGUILayout.FloatField("Longitude Second", longitudeSecond); } if(GUI.changed) { double newLatitude = fromParts(latitudeDegree, latitudeMinute, latitudeSecond); double newLongitude = fromParts(longitudeDegree, longitudeMinute, longitudeSecond); Transform t = Selection.activeTransform; GPSBeaconManager manager = new GPSBeaconManager(); Undo.RegisterUndo(t, "Change GPS Position"); t.position = manager.GetPosition(newLatitude, newLongitude); } }
// Use this for initialization void Start() { if (Application.platform == RuntimePlatform.Android) { return; } beaconManager = new GPSBeaconManager(); }
// Use this for initialization void Start() { Debug.Log("C#: AutoPositionController Start"); beaconManager = new GPSBeaconManager(); if (Application.platform == RuntimePlatform.Android) { iPhoneSettings.StartLocationServiceUpdates(); //locationManager = new UnityLocationManager(); //locationManager.onResume(); } }
public override void Start() { base.Start (); Debug.Log("C#: AutoPositionController Start"); beaconManager = new GPSBeaconManager(); if (Application.platform == RuntimePlatform.Android) { iPhoneSettings.StartLocationServiceUpdates(desiredAccuracy, updateDistance); //locationManager = new UnityLocationManager(); //locationManager.onResume(); } }
public override void Start() { base.Start(); Debug.Log("C#: AutoPositionController Start"); beaconManager = new GPSBeaconManager(); if (Application.platform == RuntimePlatform.Android) { iPhoneSettings.StartLocationServiceUpdates(desiredAccuracy, updateDistance); //locationManager = new UnityLocationManager(); //locationManager.onResume(); } }
void Update() { Transform t = Selection.activeTransform; Vector2 position; if(t == null) { position = Vector2.zero; } else { position = new Vector2(t.position.x, t.position.z); } if(position == prevPosition) { return; } GPSBeaconManager manager = new GPSBeaconManager(); manager.GetGpsPosition(t.position, out latitude, out longitude); toParts(latitude, out latitudeDegree, out latitudeMinute, out latitudeSecond); toParts(longitude, out longitudeDegree, out longitudeMinute, out longitudeSecond); Repaint(); prevPosition = position; }