void ResetSpeech()
 {
     keywords = new Dictionary <string, System.Action>()
     {
         { "circle", () => {
               lineDraw.CreateCircle();
           } },
         { "rectangle", () => {
               lineDraw.CreateRectangle();
           } },
         { "triangle", () => {
               lineDraw.CreateTriangle();
           } },
         { "undo", () => {
               lineDraw.UndoLine();
           } },
         { "yes", () => {
               levelMaster.ready = true;
           } },
         { "show all", () => {
               lineDraw.ShowLines();
           } },
         { "repeat", () => {} },
         { "options", () => {} },
         { "quit", () => {} }
     };
     speechIn = new SpeechIn(onRecognized, keywords.Keys.ToArray());
 }
Exemple #2
0
    // Start is called before the first frame update
    void Start()
    {
        speechIn = new SpeechIn(onRecognized);
        speechIn.setMetaCommands(metaCommands);
        speechOut = new SpeechOut();

        GenerateDialog().play(speechIn, speechOut);
    }
Exemple #3
0
 void Start()
 {
     speechIn  = new SpeechIn(onRecognized);
     speechOut = new SpeechOut();
     Dialog();
     speechIn.setMetaCommands(new List <string> {
         "repeat", "quit", "options"
     });
 }
    void Start()
    {
        // looks in the (current) gameObject for component of type Rigidbody
        // gameObject.GetComponent<Rigidbody>() would work as well
        playerRb     = GetComponent <Rigidbody>();
        soundEffects = GetComponent <PlayerSoundEffect>();
        //activatePlayer();

        speech = new SpeechIn(onSpeechRecognized);
        speech.StartListening(new string[] { "help", "resume" });
    }
    void Awake()
    {
        _speechIn  = new SpeechIn(onRecognized, _commands.Keys.ToArray());
        _speechOut = new SpeechOut();

        if (level < 0 || level >= enemyConfigs.Length)
        {
            Debug.LogWarning($"Level value {level} < 0 or >= enemyConfigs.Length. Resetting to 0");
            level = 0;
        }
    }
Exemple #6
0
        // Start is called before the first frame update
        public override async Task StartLevel(LineDraw lineDraw, SpeechIn speechIn, SpeechOut speechOut)
        {
            await speechOut.Speak("Now you have an empty paper, draw your own face. Feel free to use the options command for all tools.");

            lineDraw.canDraw = true;
            await speechOut.Speak("Say yes when you're ready.");

            await WaitFunction(ready);

            lineDraw.canDraw = false;
            speechOut.Speak("Congratulations! You completed your first own drawing!");
        }
    public async void play(SpeechIn speechIn, SpeechOut speechOut, bool silent = false)
    {
        asr = speechIn;
        tts = speechOut;
        if (!silent & sentences != "")
        {
            await tts.Speak(sentences);
        }
        if (soundSource && soundSource.clip)
        {
            await playSound();
        }
        if (action != null)
        {
            await action.Invoke(actionarg);
        }
        string recognized;

        switch (options.Count)
        {
        case 0:     //no options, endNode
            return;

        case 1:                                //single option, listen without return
            DialogOption singleOption = options.ToArray()[0];
            if (singleOption.commands == null) //option has no commands, move on to next node
            {
                singleOption.next.play(asr, tts);
                return;
            }
            recognized = await asr.Listen(singleOption.commands.ToArray());

            if (checkMetaCommands(recognized) == false)
            {
                singleOption.next.play(asr, tts);
            }
            break;

        default:     // various options
            recognized = await asr.Listen(generateCommandArray());

            foreach (DialogOption option in options)
            {
                if (option.commands.Contains(recognized))
                {
                    option.next.play(asr, tts);
                }
            }
            checkMetaCommands(recognized);
            return;
        }
    }
Exemple #8
0
        // Start is called before the first frame update
        public override async Task StartLevel(LineDraw lineDraw, SpeechIn speechIn, SpeechOut speechOut)
        {
            await speechOut.Speak("Now you can find your Mouth and the two Eyes in the picture. Draw a nose in the right spot");

            await speechOut.Speak("Use the voice commands Mouth, Eye, 0 and 1 and see whats happening.");

            lineDraw.canDraw = true;
            await speechOut.Speak("Can you find your drawn nose? Say yes when you're ready.");

            await WaitFunction(ready);

            lineDraw.canDraw = false;
            await lineDraw.TraceLine(lineDraw.lines["line" + (lineDraw.lineCount - 1)]);
        }
    void Awake()
    {
        // Ensure these are disabled at the start of the game.
        player.SetActive(false);
        enemy.SetActive(false);

        _speechIn  = new SpeechIn(onRecognized, _commands.Keys.ToArray());
        _speechOut = new SpeechOut();

        if (level < 0 || level >= enemyConfigs.Length)
        {
            Debug.LogWarning($"Level value {level} < 0 or >= enemyConfigs.Length. Resetting to 0");
            level = 0;
        }
    }
Exemple #10
0
        // Start is called before the first frame update
        public override async Task StartLevel(LineDraw lineDraw, SpeechIn speechIn, SpeechOut speechOut)
        {
            await speechOut.Speak("Here you can find the first half of a face.");

            LineRenderer face = GameObject.Find("Face").GetComponent <LineRenderer>();

            GameObject.Find("Panto").GetComponent <GameManager>().AddVoiceCommand("Face", () =>
            {
                lineDraw.TraceLine(face);
            });
            await speechOut.Speak("Draw the second half.");

            lineDraw.canDraw = true;
            await speechOut.Speak("Say yes when you're ready.");

            await WaitFunction(ready);

            lineDraw.canDraw = false;
            await speechOut.Speak("Congrats you just drew a face!");
        }
Exemple #11
0
        // Start is called before the first frame update
        public override async Task StartLevel(LineDraw lineDraw, SpeechIn speechIn, SpeechOut speechOut)
        {
            await speechOut.Speak("Welcome to Panto Drawing");

            await speechOut.Speak("Explore your drawing area. Say yes when you're ready.");

            Debug.Log(drawn);
            await WaitFunction(ready);

            Debug.Log(drawn);
            await speechOut.Speak("Lets make your first drawing.");

            LineRenderer mouth = GameObject.Find("Mouth").GetComponent <LineRenderer>();

            GameObject.Find("Panto").GetComponent <GameManager>().AddVoiceCommand("Mouth", () =>
            {
                lineDraw.TraceLine(mouth);
            });

            await speechOut.Speak("Here you can feel the first half of a mouth.");

            await lineDraw.TraceLine(mouth);

            await speechOut.Speak("Draw the second half. Turn the upper Handle to start drawing.");

            lineDraw.FindStartingPoint(mouth);
            lineDraw.canDraw = true;
            await speechOut.Speak("Say yes when you're ready.");

            Debug.Log(drawn);
            await WaitFunction(ready);

            Debug.Log(drawn);
            lineDraw.canDraw = false;
            LineRenderer secondMouth = lineDraw.lines["line" + (lineDraw.lineCount - 1)];

            lineDraw.CombineLines(mouth, secondMouth, true); //they will be both one line in "Mouth", invert the second line
            await lineDraw.TraceLine(mouth);
        }
Exemple #12
0
        // Start is called before the first frame update
        public override async Task StartLevel(LineDraw lineDraw, SpeechIn speechIn, SpeechOut speechOut)
        {
            LineRenderer eye = GameObject.Find("Eye").GetComponent <LineRenderer>();

            GameObject.Find("Panto").GetComponent <GameManager>().AddVoiceCommand("Eye", () =>
            {
                lineDraw.TraceLine(eye);
            });
            lineDraw.TraceLine(eye);
            await speechOut.Speak("Here you can feel a human eye.");

            await speechOut.Speak("Draw the second eye now.");

            lineDraw.canDraw = true;
            await speechOut.Speak("Say circle when you're ready, then yes.");

            await WaitFunction(ready);

            lineDraw.canDraw = false;
            LineRenderer secondEye = lineDraw.lines["line" + (lineDraw.lineCount - 1)];

            await lineDraw.TraceLine(secondEye);
        }
 void Start()
 {
     Debug.Log("Hit spacebar to pause, hit return to change commands");
     speechIn = new SpeechIn(onRecognized, commands);
     speechIn.StartListening(new string[] { "hungry" }); // you can override here
 }
Exemple #14
0
 void Start()
 {
     speechIn = new SpeechIn(onRecognized, commands);
     Dialog();
 }
Exemple #15
0
 // Start is called before the first frame update
 public override async Task StartLevel(LineDraw lineDraw, SpeechIn speechIn, SpeechOut speechOut)
 {
     await speechOut.Speak("Turn the upper handle to start drawing, use the options command for all available functions. After drawing a line you can find it too.");
 }
Exemple #16
0
 void Start()
 {
     speechIn  = new SpeechIn(onRecognized);
     speechOut = new SpeechOut();
     Dialog(); //Separately run asynchronous Dialog system.
 }
Exemple #17
0
 public abstract Task StartLevel(LineDraw lineDraw, SpeechIn speechIn, SpeechOut speechOut);
        //public FirstLevel firstLevel; um die level ggf auszulagern in ein eigenes Skript aber das mag grad nciht

        void Awake()
        {
            speechIn  = new SpeechIn(onRecognized, keywords.Keys.ToArray());
            speechOut = new SpeechOut();
        }