public override void DidAccelerate(UIAccelerometer accelerometer, UIAcceleration acceleration) { _controller.loggingView.AppendTextLine( String.Format("x = {0:f}, y={1:f}, z={2:f}", acceleration.X, acceleration.Y, acceleration.Z)); }
public override void DidAccelerate (UIAccelerometer accelerometer, UIAcceleration acceleration) { _controller.loggingView.AppendTextLine ( String.Format ("x = {0:f}, y={1:f}, z={2:f}", acceleration.X, acceleration.Y, acceleration.Z)); }
public override void DidAccelerate(UIAccelerometer accelerometer, UIAcceleration acceleration) { if (gameSuspended) { return; } float accel_filter = 0.1f; bird_vel.X = bird_vel.X * accel_filter + (float)acceleration.X * (1.0f - accel_filter) * 500.0f; }
public override void DidAccelerate(UIAccelerometer accelerometer, UIAcceleration acceleration) { var filterFactor = .5f; var accelX = (float)acceleration.X * filterFactor + (1 - filterFactor) * prevX; var accelY = (float)acceleration.Y * filterFactor + (1 - filterFactor) * prevY; prevX = accelX; prevY = accelY; PointF v; space.Gravity = new PointF (300 * accelY, -300 * accelX); }
public override void DidAccelerate(UIAccelerometer accelerometer, UIAcceleration acceleration) { var filterFactor = .5f; var accelX = (float)acceleration.X * filterFactor + (1 - filterFactor) * prevX; var accelY = (float)acceleration.Y * filterFactor + (1 - filterFactor) * prevY; prevX = accelX; prevY = accelY; PointF v; space.Gravity = new PointF(300 * accelY, -300 * accelX); }
public override void DidAccelerate(UIAccelerometer accelerometer, UIAcceleration acceleration) { callback(accelerometer,acceleration); }
// 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)); }; }
void DidAccelerate(UIAccelerometer accelerometer, UIAcceleration acceleration) { if(gameSuspended) return; float accel_filter = 0.1f; bird_vel.X = bird_vel.X * accel_filter + (float)acceleration.X * (1.0f - accel_filter) * 500.0f; }
// 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 } }
public override void DidAccelerate(UIAccelerometer accelerometer, UIAcceleration acceleration) { Callback(accelerometer, acceleration); }