// Called by GazeGestureManager when the user performs a tap gesture. public void OnSelect() { // On each tap gesture, toggle whether the user is in placing mode. placing = !placing; // If the user is in placing mode, display the spatial mapping mesh. if (placing) { spatialMappingManager.DrawVisualMeshes = true; Debug.Log(gameObject.name + " : Removing existing world anchor if any."); anchorManager.RemoveAnchor(gameObject); } // If the user is not in placing mode, hide the spatial mapping mesh. else { spatialMappingManager.DrawVisualMeshes = false; // Add world anchor when object placement is done. anchorManager.AttachAnchor(gameObject, SavedAnchorFriendlyName); ttsMgr.SpeakText("Reference Anchor Placed!"); } }
void Awake() { keywords.Add("Select this bird", () => { var focusObject = GazeGestureManager.Instance.FocusedObject; if (focusObject != null) { Bird birdCandidate = focusObject.GetComponent <Bird>(); if (birdCandidate != null) { BirdManager.Instance.SelectBird(birdCandidate); } else { textMan.SpeakText("That is not a bird."); } } }); keywords.Add("Land over there", () => { if (BirdManager.Instance.SelectedBird != null) { LandSelectedBirdAtLocation(cursor.transform.position); } else { textMan.SpeakText("No bird selected"); } }); keywords.Add("Fly over there", () => { if (BirdManager.Instance.SelectedBird != null) { FlyBirdToLocation(); } else { textMan.SpeakText("No bird selected"); } }); keywords.Add("Come to me", () => { SummonBird(); }); keywords.Add("Sing to me", () => { if (BirdManager.Instance.SelectedBird != null) { BirdManager.Instance.SelectedBird.Sing(); } else { textMan.SpeakText("No bird selected"); } }); keywords.Add("Make Bird", () => { MakeBird(); }); keywords.Add("Make Ten Birds", () => { MakeTenBirds(); }); keywords.Add("Kill All Birds", () => { KillAllBirds(); }); keywords.Add("Chase Me", () => { ChaseMe(); }); keywords.Add("Stop Chasing Me", () => { StopChasingMe(); }); // Tell the KeywordRecognizer about our keywords. keywordRecognizer = new KeywordRecognizer(keywords.Keys.ToArray()); // Register a callback for the KeywordRecognizer and start recognizing! keywordRecognizer.OnPhraseRecognized += KeywordRecognizer_OnPhraseRecognized; keywordRecognizer.Start(); }