using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.Windows.Speech;
/// <summary>
/// 语音识别
/// </summary>
public class SpeechManager : MonoBehaviour
{
private KeywordRecognizer KeywordRecognizer = null;
Dictionary<string, System.Action> keywords = new Dictionary<string, Action>();
void Start()
{
keywords.Add("Reset world", () => { this.BroadcastMessage("OnReset"); });
keywords.Add("Drop Sphere", () =>
{
var focusObject = GazeGestureManager.Instance.FocusedObject;
if (focusObject != null)
{
focusObject.SendMessage("OnDrop", SendMessageOptions.DontRequireReceiver);
}
});
KeywordRecognizer = new KeywordRecognizer(keywords.Keys.ToArray());
//识别关键字回调
Hololens 语音识别
最新推荐文章于 2024-05-24 03:52:49 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)