// Start is called before the first frame update void Start() { _asr = new Asr(apiKey, secretKey); StartCoroutine(_asr.GetAccessToken()); StartCoroutine(Timer()); _clipRecord = Microphone.Start(null, false, 30, 16000); }
void Start() { _asr = new Asr(APIKey, SecretKey); StartCoroutine(_asr.GetAccessToken()); StartButton.gameObject.SetActive(true); StopButton.gameObject.SetActive(false); DescriptionText.text = ""; StartButton.onClick.AddListener(OnClickStartButton); StopButton.onClick.AddListener(OnClickStopButton); light1.SetActive(false); light2.SetActive(false); light3.SetActive(false); light4.SetActive(false); light5.SetActive(false); light6.SetActive(false); light7.SetActive(false); light8.SetActive(false); lightmain.SetActive(false); // dog = ;//生成敌人 dog = Random.Range(1, 8); //生成敌人 patient.transform.localScale = new Vector3(50, 50, 60); // dog = 1; if (dog == 1) { Instantiate(patient, new Vector3(10.902f, 0.5f, -3.24f), Quaternion.Euler(-180, -90, 0)); } else if (dog == 2) { Instantiate(patient, new Vector3(10.902f, 0.5f, 9.25f), Quaternion.Euler(-180, -90, 0)); } else if (dog == 3) { Instantiate(patient, new Vector3(10.902f, 0.5f, 21.52f), Quaternion.Euler(-180, -90, 0)); } else if (dog == 4) { Instantiate(patient, new Vector3(10.902f, 0.5f, 34.17f), Quaternion.Euler(-180, -90, 0)); } else if (dog == 5) { Instantiate(patient, new Vector3(-5.31f, 0.5f, 36), Quaternion.Euler(-180, -90, 0)); } else if (dog == 6) { Instantiate(patient, new Vector3(-5.31f, 0.5f, 23.47f), Quaternion.Euler(-180, -90, 0)); } else if (dog == 7) { Instantiate(patient, new Vector3(-5.31f, 0.5f, 14.14f), Quaternion.Euler(-180, -90, 0)); } else if (dog == 8) { Instantiate(patient, new Vector3(-5.31f, 0.5f, 1.92f), Quaternion.Euler(-180, -90, 0)); } Debug.Log(dog); patText.text = "Your patient is in ward No." + dog; }
// Microphone is not supported in Webgl #if !UNITY_WEBGL void Start() { _asr = new Asr(APIKey, SecretKey); StartCoroutine(_asr.GetAccessToken()); StartButton.gameObject.SetActive(true); StopButton.gameObject.SetActive(false); DescriptionText.text = ""; StartButton.onClick.AddListener(OnClickStartButton); StopButton.onClick.AddListener(OnClickStopButton); }
////每一振处理那一帧接收的音频文件 //float GetMaxVolume() //{ // float maxVolume = 0f; // //剪切音频 // float[] volumeData = new float[128]; // int offset = Microphone.GetPosition(null) - 128 + 1; // if (offset < 0) // { // return 0; // } // _clipRecord.GetData(volumeData, offset); // for (int i = 0; i < 128; i++) // { // float tempMax = volumeData[i];//修改音量的敏感值 // if (maxVolume < tempMax) // { // maxVolume = tempMax; // } // } // return maxVolume; //} void Start() { _asr = new Asr(APIKey, SecretKey); StartCoroutine(_asr.GetAccessToken()); StartButton.gameObject.SetActive(true); StopButton.gameObject.SetActive(false); DescriptionText.text = ""; StartButton.onClick.AddListener(OnClickStartButton); StopButton.onClick.AddListener(OnClickStopButton); // _clipRecord = Microphone.Start(null, false, 30, 16000); }
void Start() { _asr = new Asr(APIKey, SecretKey);//实例 StartCoroutine(_asr.GetAccessToken()); StartButton.gameObject.SetActive(true); StopButton.gameObject.SetActive(false); DescriptionText.gameObject.SetActive(true); StartButton.onClick.AddListener(OnClickStartButton);//开始按钮监听 StopButton.onClick.AddListener(OnClickStopButton); SceneController.Instance.bgm.SetActive(false); }
// Microphone is not supported in Webgl #if !UNITY_WEBGL void Start() { _audioSource = gameObject.GetComponent <AudioSource>(); _asr = new Asr(APIKey, SecretKey); StartCoroutine(_asr.GetAccessToken()); StartButton.gameObject.SetActive(true); StopButton.gameObject.SetActive(false); DescriptionText.text = ""; StartButton.onClick.AddListener(OnClickStartButton); StopButton.onClick.AddListener(OnClickStopButton); ReplayButton.onClick.AddListener(OnClickReplayButtion); ReplayButton.gameObject.SetActive(false); }
// Use this for initialization void Start() { instance = this; //识别 _asr = new Asr(APIKey, SecretKey); StartCoroutine(_asr.GetAccessToken()); StartButton.gameObject.SetActive(true); StopButton.gameObject.SetActive(false); DescriptionText.text = ""; StartButton.onClick.AddListener(OnClickStartButton); StopButton.onClick.AddListener(OnClickStopButton); //合成 _tts = new Tts(APIKey, SecretKey); StartCoroutine(_tts.GetAccessToken()); _audioSource = gameObject.AddComponent <AudioSource>(); DescriptionText.text = ""; }
// Microphone is not supported in Webgl #if !UNITY_WEBGL void Start() { _asr = new Asr(APIKey, SecretKey); StartCoroutine(_asr.GetAccessToken()); }