예제 #1
0
    private void GestureRecognizer_TappedEvent(InteractionSourceKind source, int tapCount, Ray headRay)
    {
        GazeManager gm = GazeManager.Instance;

        if (gm.IsGazingAtObject)
        {
            // Get the target object
            GameObject obj = gm.HitInfo.collider.gameObject;

            // Try and get a TTS Manager
            TextToSpeechManager tts = null;
            if (obj != null)
            {
                tts = obj.GetComponent <TextToSpeechManager>();
            }

            // If we have a text to speech manager on the target object, say something.
            // This voice will appear to emanate from the object.
            if (tts != null && !tts.IsSpeaking())
            {
                // Get the name
                var voiceName = Enum.GetName(typeof(TextToSpeechVoice), tts.Voice);

                // Create message
                var msg = string.Format("This is the {0} voice. It should sound like it's coming from the object you clicked. Feel free to walk around and listen from different angles.", voiceName);

                // Speak message
                tts.SpeakText(msg);
            }
            else if (tts.IsSpeaking())
            {
                tts.StopSpeaking();
            }
        }
    }
예제 #2
0
 // Uses Text to Speech Manager to say whatever is in the current open information panel
 public void Say()
 {
     if (textToSpeechManager != null)
     {
         if (!textToSpeechManager.IsSpeaking())
         {
             textToSpeechManager.SpeakText(a.getSpeechText());
         }
         else
         {
             textToSpeechManager.StopSpeaking();
         }
     }
 }
예제 #3
0
    void IInputHandler.OnInputUp(InputEventData eventData)
    {
        if (eventData.PressType == InteractionSourcePressType.Select)
        {
            GameObject obj = FocusManager.Instance.TryGetFocusedObject(eventData);

            // Try and get a TTS Manager
            TextToSpeechManager tts = (obj == null)
                ? null
                : obj.GetComponent <TextToSpeechManager>();

            if (tts != null)
            {
                // If we have a text to speech manager on the target object, say something.
                // This voice will appear to emanate from the object.
                if (!tts.IsSpeaking())
                {
                    // Get the name
                    var voiceName = Enum.GetName(typeof(TextToSpeechVoice), tts.Voice);

                    // Create message
                    var msg = string.Format("This is the {0} voice. It should sound like it's coming from the object you clicked. Feel free to walk around and listen from different angles.", voiceName);

                    // Speak message
                    tts.SpeakText(msg);
                }
                else
                {
                    tts.StopSpeaking();
                }

                eventData.Use(); // Mark the event as used, so it doesn't fall through to other handlers.
            }
        }
    }
예제 #4
0
 public virtual void OnInputClicked(InputEventData eventData)
 {
     if (!txt2speech.IsSpeaking())
     {
         Debug.Log("Tap Gesture");
         Human.transform.position = proxy.transform.position;
         Human.transform.rotation = proxy.transform.rotation;
         AlignScript.snp          = true;
         txtAnim.SetBool("trigFade", false);
         Destroy(this);
     }
 }