using System.Collections.Generic; namespace UnityEngine.XR.Management.Tests.Standalone { public class StandaloneLoader : XRLoaderHelper { static List s_StandaloneSubsystemDescriptors = new List(); public StandaloneSubsystem standaloneSubsystem { get { return GetLoadedSubsystem(); } } public bool started { get; protected set; } public bool stopped { get; protected set; } public bool deInitialized { get; protected set; } void OnStartCalled() { started = true; } void OnStopCalled() { stopped = true; } void OnDestroyCalled() { deInitialized = true; } public override bool Initialize() { started = false; stopped = false; deInitialized = false; CreateSubsystem(s_StandaloneSubsystemDescriptors, "Standalone Subsystem"); if (standaloneSubsystem == null) return false; standaloneSubsystem.startCalled += OnStartCalled; standaloneSubsystem.stopCalled += OnStopCalled; standaloneSubsystem.destroyCalled += OnDestroyCalled; return true; } public override bool Start() { if (standaloneSubsystem != null) StartSubsystem(); return true; } public override bool Stop() { if (standaloneSubsystem != null) StopSubsystem(); return true; } public override bool Deinitialize() { DestroySubsystem(); if (standaloneSubsystem != null) { standaloneSubsystem.startCalled -= OnStartCalled; standaloneSubsystem.stopCalled -= OnStopCalled; standaloneSubsystem.destroyCalled -= OnDestroyCalled; } return base.Deinitialize(); } } }