示例#1
0
 public MixedRealitySpatialAwarenessSystem(
     IMixedRealityServiceRegistrar registrar,
     MixedRealitySpatialAwarenessSystemProfile profile) : base(registrar, profile)
 {
     if (registrar == null)
     {
         Debug.LogError("The MixedRealitySpatialAwarenessSystem object requires a valid IMixedRealityServiceRegistrar instance.");
     }
 }
        /// <summary>
        /// Performs initialization tasks for the spatial awareness system.
        /// </summary>
        private void InitializeInternal()
        {
            MixedRealitySpatialAwarenessSystemProfile profile = ConfigurationProfile as MixedRealitySpatialAwarenessSystemProfile;

            if (profile != null && GetDataProviders <IMixedRealitySpatialAwarenessObserver>().Count == 0)
            {
                // Register the spatial observers.
                for (int i = 0; i < profile.ObserverConfigurations.Length; i++)
                {
                    MixedRealitySpatialObserverConfiguration configuration = profile.ObserverConfigurations[i];
                    object[] args = { this, configuration.ComponentName, configuration.Priority, configuration.ObserverProfile };

                    RegisterDataProvider <IMixedRealitySpatialAwarenessObserver>(
                        configuration.ComponentType.Type,
                        configuration.RuntimePlatform,
                        args);
                }
            }
        }
        /// <inheritdoc/>
        public override void Enable()
        {
            MixedRealitySpatialAwarenessSystemProfile profile = ConfigurationProfile as MixedRealitySpatialAwarenessSystemProfile;

            if ((GetDataProviders <IMixedRealitySpatialAwarenessObserver>().Count == 0) && (profile != null))
            {
                // Register the spatial observers.
                for (int i = 0; i < profile.ObserverConfigurations.Length; i++)
                {
                    MixedRealitySpatialObserverConfiguration configuration = profile.ObserverConfigurations[i];
                    object[] args = { Registrar, this, configuration.ComponentName, configuration.Priority, configuration.ObserverProfile };

                    RegisterDataProvider <IMixedRealitySpatialAwarenessObserver>(
                        configuration.ComponentType.Type,
                        configuration.RuntimePlatform,
                        args);
                }
            }

            // Ensure data providers are enabled (performed by the base class)
            base.Enable();
        }
示例#4
0
        /// <inheritdoc/>
        public override void Enable()
        {
            base.Enable();

            MixedRealitySpatialAwarenessSystemProfile profile = ConfigurationProfile as MixedRealitySpatialAwarenessSystemProfile;

            if ((observers.Count == 0) && (profile != null))
            {
                // Register the spatial observers.
                for (int i = 0; i < profile.ObserverConfigurations.Length; i++)
                {
                    MixedRealitySpatialObserverConfiguration configuration = profile.ObserverConfigurations[i];
                    object[] args = { Registrar, this, configuration.ComponentName, configuration.Priority, configuration.ObserverProfile };

                    if (Registrar.RegisterDataProvider <IMixedRealitySpatialAwarenessObserver>(
                            configuration.ComponentType.Type,
                            configuration.RuntimePlatform,
                            args))
                    {
                        observers.Add(Registrar.GetDataProvider <IMixedRealitySpatialAwarenessObserver>(configuration.ComponentName));
                    }
                }
            }
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="registrar">The <see cref="IMixedRealityServiceRegistrar"/> instance that loaded the service.</param>
 /// <param name="profile">The configuration profile for the service.</param>
 public MixedRealitySpatialAwarenessSystem(
     MixedRealitySpatialAwarenessSystemProfile profile) : base(profile)
 { }
 public MixedRealitySpatialAwarenessSystem(
     IMixedRealityServiceRegistrar registrar,
     MixedRealitySpatialAwarenessSystemProfile profile) : this(profile)
 {
     Registrar = registrar;
 }