Пример #1
0
 //        private void setAnnotationBehavior ()
 //        {
 //            //Funtion in order to add annotation points from the map itself (the user can add POI's touching the map): It is not implemented and this CODE DOES NOT WORK
 //            unityMapView.GetViewForAnnotation = delegate(MKMapView mapView, NSObject annotation) {
 //                // Called by the map whenever an annotation is added and needs to be displayed
 //                if (annotation is MKUserLocation)
 //                    return null;
 //            };
 //        }
 private void initAccelerometre()
 {
     acceleration = new Acceleration ();
     uiAcceleration = new UIAcceleration ();
     UIAccelerometer.SharedAccelerometer.UpdateInterval = 1 / 10;
     //This value could be set, in a new development, as a parameter
     UIAccelerometer.SharedAccelerometer.Acceleration += delegate(object sender, UIAccelerometerEventArgs e) {
         uiAcceleration = e.Acceleration;
         acceleration.X = (float)uiAcceleration.X;
         acceleration.Y = (float)uiAcceleration.Y;
         acceleration.Z = (float)uiAcceleration.Z;
         acceleration.Accel = (float)Math.Sqrt (Math.Pow (acceleration.X, 2) + Math.Pow (acceleration.Y, 2) + Math.Pow (acceleration.Z, 2));
     };
 }
Пример #2
0
 //        private void setAnnotationBehavior ()
 //        {
 //            //Funtion in order to add annotation points from the map itself (the user can add POI's touching the map): It is not implemented and this CODE DOES NOT WORK
 //            unityMapView.GetViewForAnnotation = delegate(MKMapView mapView, NSObject annotation) {
 //                // Called by the map whenever an annotation is added and needs to be displayed
 //                if (annotation is MKUserLocation)
 //                    return null;
 //            };
 //        }
 private void initAccelerometre()
 {
     try {
         acceleration = new Acceleration ();
         uiAcceleration = new UIAcceleration ();
         UIAccelerometer.SharedAccelerometer.UpdateInterval = 1 / 10;
         //This value could be set, in a new development, as a parameter
         UIAccelerometer.SharedAccelerometer.Acceleration += delegate(object sender, UIAccelerometerEventArgs e) {
             uiAcceleration = e.Acceleration;
             acceleration.X = (float)uiAcceleration.X;
             acceleration.Y = (float)uiAcceleration.Y;
             acceleration.Z = (float)uiAcceleration.Z;
             acceleration.Accel = (float)Math.Sqrt (Math.Pow (acceleration.X, 2) + Math.Pow (acceleration.Y, 2) + Math.Pow (acceleration.Z, 2));
         };
     } catch (Exception ex) {
         #if DEBUG
         SystemLogger.Log (SystemLogger.Module.PLATFORM, "Exception initializing Accelerometer. Message: " + ex.Message);
         #endif
     }
 }