예제 #1
0
        public GameRecognizer() : base()
        {
            enemyHandling = new EnemyHandling();
            helper        = new SpeechRecognitionHelper(this);
            currentState  = RecognitionState.INACTIVE;

            mainRecognizer.LoadGrammar(new Grammar(new Choices(Program.controlCommands.getNewTargetCommand)));
            mainRecognizer.LoadGrammar(new Grammar(new Choices(Program.controlCommands.getTargetKilledCommand)));
            mainRecognizer.LoadGrammar(new Grammar(new Choices(Program.controlCommands.getUndoCommand)));
            mainRecognizer.LoadGrammar(new Grammar(new Choices(Program.controlCommands.getRemoveTargetCommand)));

            getCurrentGrammars.Add(Program.controlCommands.getNewTargetCommand, 0);
            getCurrentGrammars.Add(Program.controlCommands.getTargetKilledCommand, 1);
            getCurrentGrammars.Add(Program.controlCommands.getUndoCommand, 2);
            getCurrentGrammars.Add(Program.controlCommands.getRemoveTargetCommand, 3);
        }
예제 #2
0
 public ChestRecognizer() : base()
 {
     helper  = new SpeechRecognitionHelper(this);
     stack   = new DropOutStack <ItemInsertion>(5);
     evnt    = new ManualResetEventSlim(false);
     numbers = new SpeechRecognitionEngine();
     numbers.SetInputToDefaultAudioDevice();
     numbers.SpeechRecognized += Numbers_SpeechRecognized;
     string[] strs = new string[201];
     for (int i = 0; i < strs.Length; i++)
     {
         strs[i] = i.ToString();
     }
     numbers.LoadGrammar(new Grammar(new Choices(strs)));
     mainRecognizer.LoadGrammar(new Grammar(new Choices(Program.controlCommands.getUndoCommand)));
     getCurrentGrammars.Add(Program.controlCommands.getUndoCommand, 2);
 }