예제 #1
0
        internal static void PlatformStart(SensorSpeed sensorSpeed)
        {
            var delay = SensorDelay.Normal;

            switch (sensorSpeed)
            {
            case SensorSpeed.Normal:
                delay = SensorDelay.Normal;
                break;

            case SensorSpeed.Fastest:
                delay = SensorDelay.Fastest;
                break;

            case SensorSpeed.Game:
                delay = SensorDelay.Game;
                break;

            case SensorSpeed.UI:
                delay = SensorDelay.Ui;
                break;
            }

            listener     = new MagnetometerListener();
            magnetometer = Platform.SensorManager.GetDefaultSensor(SensorType.MagneticField);
            Platform.SensorManager.RegisterListener(listener, magnetometer, delay);
        }
예제 #2
0
        internal static void PlatformStart(SensorSpeed sensorSpeed)
        {
            var delay = sensorSpeed.ToPlatform();

            listener     = new MagnetometerListener();
            magnetometer = Platform.SensorManager.GetDefaultSensor(SensorType.MagneticField);
            Platform.SensorManager.RegisterListener(listener, magnetometer, delay);
        }
예제 #3
0
        internal static void PlatformStop()
        {
            if (listener == null || magnetometer == null)
            {
                return;
            }

            Platform.SensorManager.UnregisterListener(listener, magnetometer);
            listener.Dispose();
            listener = null;
        }