// // /*===============================================================================
// // Copyright (C) 2025 PhantomsXR Ltd. All Rights Reserved.
// //
// // This file is part of the Phantom.XRMOD.QuestModule.Runtime.
// //
// // The XR-MOD cannot be copied, distributed, or made available to
// // third-parties for commercial purposes without written permission of PhantomsXR Ltd.
// //
// // Contact nswell@phantomsxr.com for licensing requests.
// // ===============================================================================*/
using Phantom.XRMOD.Core.Runtime;
using Phantom.XRMOD.XRMODInput.Runtime;
namespace Phantom.XRMOD.QuestModule.Runtime
{
///
/// Feature decorator for enabling/disabling locomotion features on Meta Quest.
///
/// Controls the activation of teleport interactors, character controllers, and locomotion providers.
///
///
public class MetaQuestLocomotionFeatureDecorator : BaseMetaQuestFeatureDecorator
{
private ArchitectureComponentsModel architectureComponentsModel;
///
/// Initializes a new instance of the class.
///
public MetaQuestLocomotionFeatureDecorator()
{
architectureComponentsModel = IocContainer.GetIoc.Resolve();
}
///
/// Starts the locomotion feature.
///
/// Enables teleport interactors, character controller, and locomotion provider.
///
///
public override void StartAlgorithm()
{
base.StartAlgorithm();
architectureComponentsModel.LeftController.Find("Teleport Interactor").gameObject.SetActive(true);
architectureComponentsModel.RightController.Find("Teleport Interactor").gameObject.SetActive(true);
architectureComponentsModel.CharacterController.enabled = true;
architectureComponentsModel.LocomotionProvider.gameObject.SetActive(true);
}
///
/// Determines if this feature is supported.
///
/// Always returns true.
public override bool SupportThisFeature()
{
return true;
}
///
/// Pauses the algorithm.
///
/// Not implemented.
public override void PauseAlgorithm()
{
throw new System.NotImplementedException();
}
///
/// Stops the locomotion feature.
///
/// Disables character controller, locomotion provider, and teleport interactors.
///
///
public override void StopAlgorithm()
{
architectureComponentsModel.CharacterController.enabled = false;
architectureComponentsModel.LocomotionProvider.gameObject.SetActive(false);
architectureComponentsModel.LeftController.Find("Teleport Interactor").gameObject.SetActive(false);
architectureComponentsModel.RightController.Find("Teleport Interactor").gameObject.SetActive(false);
}
}
}