protected override void Awake() { base.Awake(); _metaContext = FindObjectOfType <MetaContextBridge>().CurrentContextInternal; if (!_metaContext.ContainsModule <IMetaInputModule>()) { _metaContext.Add <IMetaInputModule>(this); } if (!_metaContext.ContainsModule <IKeyboardWrapper>()) { _metaContext.Add <IKeyboardWrapper>(new UnityKeyboardWrapper()); } }
/// <summary> /// Creates an <see cref="IEnvironmentInitializer"/> for the given environment selection result. /// </summary> /// <param name="environmentInitializaterType">The environment initializer type.</param> /// <returns>The environment initializer for the given environment initializer type.</returns> public IMetaReconstruction Create(Transform parent) { Transform metaReconstructionTransform = MonoBehaviour.Instantiate(_metaReconstructionPrefab); metaReconstructionTransform.parent = parent; metaReconstructionTransform.position = Vector3.zero; IMetaReconstruction metaReconstruction = metaReconstructionTransform.GetComponent <IMetaReconstruction>(); if (metaReconstruction != null) { if (!_metaContext.ContainsModule <IMetaReconstruction>()) { _metaContext.Add(metaReconstruction); } _metaContext.Add <IMeshGenerator>(new MeshGenerator(true, EnvironmentConstants.MaxTriangles)); _metaContext.Add <IModelFileManipulator>(new OBJFileManipulator()); } return(metaReconstruction); }
/// <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); }