// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using Microsoft.MixedReality.Toolkit.SpatialAwareness;
using Microsoft.MixedReality.Toolkit.Utilities;
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.Experimental.SpatialAwareness
{
///
/// Service manager supporting running the spatial awareness system, without requiring the MixedRealityToolkit object.
///
[AddComponentMenu("Scripts/MRTK/SDK/SpatialAwarenessSystemManager")]
public class SpatialAwarenessSystemManager : BaseServiceManager
{
[SerializeField]
[Tooltip("The spatial awareness system type that will be instantiated.")]
[Implements(typeof(IMixedRealitySpatialAwarenessSystem), TypeGrouping.ByNamespaceFlat)]
private SystemType SpatialAwarenessSystemType = null;
[SerializeField]
[Tooltip("The spatial awareness system configuration profile.")]
private MixedRealitySpatialAwarenessSystemProfile profile = null;
private void Awake()
{
InitializeManager();
}
protected override void OnDestroy()
{
UninitializeManager();
base.OnDestroy();
}
///
/// Initialize the manager.
///
private void InitializeManager()
{
// The spatial awareness system class takes arguments for:
object[] args = { profile };
Initialize(SpatialAwarenessSystemType.Type, args: args);
}
///
/// Uninitialize the manager.
///
private void UninitializeManager()
{
Uninitialize();
}
}
}