private IEnvironmentInitializer CreateRelocalizationInactiveInitializer(bool surfaceReconstructionActive) { if (!surfaceReconstructionActive) { return(CreateDefaultInitializer()); } IMetaReconstruction metaReconstruction = _metaContext.Get <IMetaReconstruction>(); IEnvironmentInitialization initialization = new ReconstructionOnlyEnvironmentInitialization(_slamLocalizer, metaReconstruction, _environmentScanControllerPrefab); IEnvironmentReset environmentReset = new ReconstructionOnlyEnvironmentReset(metaReconstruction); return(new EnvironmentInitializer(initialization, environmentReset, _metaLocalization)); }
/// <summary> /// Creates an instance of <see cref="EnvironmentInitializerFactory"/> class. /// </summary> /// <param name="metaContext">The Context to acces to the required services.</param> /// <param name="environmentScanControllerPrefab">The scan selector prefab used to control the environment reconstruction.</param> internal EnvironmentInitializerFactory(IMetaContextInternal metaContext, BaseEnvironmentScanController environmentScanControllerPrefab) { if (metaContext == null) { throw new ArgumentNullException("metaContext"); } _metaContext = metaContext; _environmentScanControllerPrefab = environmentScanControllerPrefab; _metaLocalization = _metaContext.Get <MetaLocalization>(); _environmentProfileRepository = _metaContext.Get <IEnvironmentProfileRepository>(); _slamLocalizer = GameObject.FindObjectOfType <SlamLocalizer>(); }
protected override void Start() { base.Start(); _inputWrapper = _metaContext.Get <IInputWrapper>(); _inputWrapper.LockState = _metaMouseConfig.EnableOnStart ? CursorLockMode.Locked : CursorLockMode.None; GameObject mousePrefab = (GameObject)Resources.Load("MetaMouse"); GameObject mouseInstance = Instantiate(mousePrefab); _metaMouse = mouseInstance.GetComponent <MetaMouse>(); _metaMouse.Initialize(_metaContext.Get <IEventCamera>(), _inputWrapper, this); _metaMouse.StartMouse(_metaMouseConfig.EnableOnStart); }
/// <summary> /// Updates the alignment profile, if necessary. /// </summary> private AlignmentProfile _updateAlignmentProfile() { var oldAlignmentIndex = _alignmentIndexFromFile; _alignmentIndexFromFile = _getActiveAlignmentIndexFromFile(); if (_alignmentIndexFromFile != oldAlignmentIndex && _metaContext != null && _metaContext.ContainsModule <IUserSettings>() && //Get the more permissive user settings _metaContext.Get <IUserSettings>().HasKey(MetaConfiguration.AlignmentProfile, _alignmentIndexFromFile)) //Check that the index from file correctly indexes an alignment profile { var newProfile = _metaContext.Get <IUserSettings>() .GetSetting <AlignmentProfile>(MetaConfiguration.AlignmentProfile, _alignmentIndexFromFile); //May intentionally overwrite the existing profile _metaContext.Add <AlignmentProfile>(newProfile); return(newProfile); } return(null); }