private void OnStart() { if (File.Exists(_fullADFPath)) { _fsWatcher = new FileSystemWatcher(_alignmentDirFilePathDir); _fsWatcher.Filter = _alignmentDirFileName; _fsWatcher.NotifyFilter = NotifyFilters.LastWrite; _fsWatcher.EnableRaisingEvents = true; _fsWatcher.Changed += (object o, FileSystemEventArgs e) => { var profile = _updateAlignmentProfile(); foreach (IAlignmentUpdateListener listener in AlignmentUpdateListeners) { listener.OnAlignmentUpdate(profile); } }; } //Run this at least once so that the index is loaded from the alignment-directory-file. var bridge = GameObject.FindObjectOfType <MetaContextBridge>(); if (bridge != null) { _metaContext = bridge.CurrentContextInternal; } _updateAlignmentProfile(); }
/// <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>(); }
private void SetContext(IMetaContextInternal context) { // Get Context Bridge if (_contextBridge == null) { _contextBridge = gameObject.GetComponent <MetaContextBridge>(); // If still null, add it if (_contextBridge == null) { _contextBridge = gameObject.AddComponent <MetaContextBridge>(); } } _contextBridge.SetContext(context); }
/// <summary> /// Creates an instance of <see cref="MetaReconstructionFactory"/> class. /// </summary> /// <param name="metaContext">The Context to acces to the required services.</param> /// <param name="environmentScanControllerPrefab">The prefab with the meta reconstruction.</param> internal MetaReconstructionFactory(IMetaContextInternal metaContext, Transform metaReconstructionPrefab) { if (metaContext == null) { throw new ArgumentNullException("metaContext"); } if (metaReconstructionPrefab == null) { throw new ArgumentNullException("metaReconstructionPrefab"); } _metaContext = metaContext; _metaReconstructionPrefab = metaReconstructionPrefab; }
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> /// Internal set for the current Meta Context /// </summary> /// <param name="context">Current Meta Context</param> internal void SetContext(IMetaContextInternal context) { _context = context; }