Пример #1
0
        /// <summary>
        /// Resolves all <see cref="WearableRequirement.DeviceConfig"/>'s registered into WearableControl into
        /// a final device config that is an aggregate of all intended state with priority for enabled
        /// sensors/gestures over disabled and faster sensor update interval over slower.
        /// </summary>
        /// <returns></returns>
        private void ResolveFinalDeviceConfig()
        {
            // Reset all state in the final device config to off/slowest speeds.
            ResetFinalDeviceConfig();

            // Process all registered wearable requirement's device config and internal device config to
            // additively update state on the final config
            for (var i = _wearableRequirements.Count - 1; i >= 0; i--)
            {
                var wr = _wearableRequirements[i];
                // If we encounter a destroyed requirement, remove it
                if (ReferenceEquals(wr, null))
                {
                    _wearableRequirements.RemoveAt(i);
                    continue;
                }

                UpdateFinalDeviceConfig(wr.DeviceConfig);
            }

            UpdateFinalDeviceConfig(_wearableDeviceConfig);

            // Check for the invalid configuration of three or more sensors and TwentyMs and if
            // this is present, throttle back the SensorUpdateInterval to FortyMs.
            if (_finalWearableDeviceConfig.HasThreeOrMoreSensorsEnabled() &&
                _finalWearableDeviceConfig.updateInterval == SensorUpdateInterval.TwentyMs)
            {
                Debug.LogWarning(WearableConstants.SensorUpdateIntervalDecreasedWarning, this);
                _finalWearableDeviceConfig.updateInterval = SensorUpdateInterval.FortyMs;
            }
        }