/// <summary> /// Initialization. /// </summary> private void Start() { SUDataProvider = SUDataProvider == null?gameObject.GetComponent <SceneUnderstandingDataProvider>() : SUDataProvider; SUUtils = SUUtils == null?gameObject.GetComponent <SceneUnderstandingUtils>() : SUUtils; SceneRoot = SceneRoot == null?SUUtils.CreateGameObject("SceneRoot", null) : SceneRoot; SceneObjectMeshMaterial = SceneObjectMeshMaterial == null?Resources.Load <Material>("Materials/SceneObjectMesh") : SceneObjectMeshMaterial; SceneObjectQuadMaterial = SceneObjectQuadMaterial == null?Resources.Load <Material>("Materials/SceneObjectQuad") : SceneObjectQuadMaterial; SceneObjectWireframeMaterial = SceneObjectWireframeMaterial == null?Resources.Load <Material>("Materials/WireframeTransparent") : SceneObjectWireframeMaterial; WorldMeshMaterial = WorldMeshMaterial == null?Resources.Load <Material>("Materials/WireframeTransparent") : WorldMeshMaterial; LabelFont = LabelFont == null ? (Font)Resources.GetBuiltinResource(typeof(Font), "Arial.ttf") : LabelFont; StatusText = StatusText == null?GameObject.Find("StatusText").GetComponent <UITextDisplay>() : StatusText; // To ensure that the first update, as part of auto refresh, happens immediately. _timeElapsedSinceLastAutoRefresh = AutoRefreshIntervalInSeconds; }
/// <summary> /// Initialization. /// </summary> private void Start() { if (SUDataProvider == null) { Logger.LogWarning("InputManger.Start: SceneUnderstandingDataProvider component is not set on the InputManager. Input will not work."); return; } if (SUDisplayManager == null) { Logger.LogWarning("InputManger.Start: SceneUnderstandingDisplayManager component is not set on the InputManager. Input will not work."); return; } StatusText = StatusText == null?GameObject.Find("StatusText").GetComponent <UITextDisplay>() : StatusText; HelpText = HelpText == null?GameObject.Find("HelpText").GetComponent <UITextDisplay>() : HelpText; // Sets the help text on the UITextDisplay component. SetHelpText(); // Hide the status text StatusText.Hide(); // Place the camera in a particular position and add the camera movement script, if running on PC. if (SUDataProvider.RunOnDevice == false) { Camera.main.transform.position = new Vector3(0, 0, -5.0f); Camera.main.gameObject.AddComponent <CameraMovement>(); } // Create, configure and start the gesture recognizer. _gestureRecognizer = new GestureRecognizer(); _gestureRecognizer.SetRecognizableGestures(GestureSettings.Tap); _gestureRecognizer.Tapped += GestureRecognizer_Tapped; _gestureRecognizer.StartCapturingGestures(); string[] keywords = new string[] { Keyword_Update, Keyword_AutoRefreshOff, Keyword_AutoRefreshOn, Keyword_IncreaseRadius, Keyword_DecreaseRadius, Keyword_SceneObjectsOff, Keyword_SceneObjectsOn, Keyword_SceneObjectsQuad, Keyword_SceneObjectsQuadMask, Keyword_SceneObjectsMesh, Keyword_SceneObjectsWireframe, Keyword_InferredRegionsOff, Keyword_InferredRegionsOn, Keyword_WorldMeshOff, Keyword_WorldMeshOn, Keyword_WorldMeshCoarse, Keyword_WorldMeshMedium, Keyword_WorldMeshFine, Keyword_PlatformOff, Keyword_PlatformOn, Keyword_BackgroundOff, Keyword_BackgroundOn, Keyword_UnknownOff, Keyword_UnknownOn, Keyword_CompletelyInferredOff, Keyword_CompletelyInferredOn, Keyword_MinimapOff, Keyword_MinimapOn, Keyword_SaveDataToDisk, Keyword_StatusTextOff, Keyword_StatusTextOn, Keyword_HelpTextOff, Keyword_HelpTextOn }; // Create, configure and start the keyword recognizer. _keywordRecognizer = new KeywordRecognizer(keywords); _keywordRecognizer.OnPhraseRecognized += OnPhraseRecognized; _keywordRecognizer.Start(); }