void UpdateText(KoreographyEvent evt, int sampleTime, int sampleDelta, DeltaSlice deltaSlice) { // Verify that we have Text in the Payload. if (evt.HasTextPayload()) { // Set the text if we have a text event! // We can get multiple events called at the same time (if they overlap in the track). // In this case, we prefer the event with the most recent start sample. if (curTextEvent == null || (evt != curTextEvent && evt.StartSample > curTextEvent.StartSample)) { guiTextCom.text = evt.GetTextValue(); // Store for later comparison. curTextEvent = evt; } // Clear out the text if our event ended this musical frame. if (curTextEvent.EndSample < sampleTime) { guiTextCom.text = string.Empty; // Remove so that the above timing logic works when the audio loops/jumps. curTextEvent = null; } } }
private void UpdateText(KoreographyEvent koreoEvent, int sampleTime, int sampleDelta, DeltaSlice deltaSlice) { // 判断当前事件是否有文本负荷 if (koreoEvent.HasTextPayload()) { // 更新文本的条件 // 1.当前存储的事件为空 // 2.事件叠加时取后面的事件 if (m_keCurEvent == null || m_keCurEvent.StartSample < koreoEvent.StartSample) { // 更新文本 m_text.text = koreoEvent.GetTextValue(); // 保存此次检测到的事件 m_keCurEvent = koreoEvent; } // 存储的最后一拍的时间 < 当前拍子的时间 if (m_keCurEvent.EndSample < sampleTime) { // 滞空 m_text.text = string.Empty; m_keCurEvent = null; } } }
private void UpdateText(KoreographyEvent koreoEvent, int sampleTime, int sampleDelta, DeltaSlice deltaSlice) { if (koreoEvent.HasTextPayload()) { if (curKoreoEvent == null || (koreoEvent != curKoreoEvent && koreoEvent.StartSample > curKoreoEvent.StartSample)) { text.text = koreoEvent.GetTextValue(); curKoreoEvent = koreoEvent; } if (koreoEvent.StartSample < curKoreoEvent.StartSample) { text.text = string.Empty; curKoreoEvent = null; } } }
void UpdateText(KoreographyEvent evt, int sampleTime, int sampleDelta, DeltaSlice deltaSlice) { // Verify that we have Text in the Payload. if (evt.HasTextPayload()) { // Set the text if we have a text event! // We can get multiple events called at the same time (if they overlap in the track). // In this case, we prefer the event with the most recent start sample. if (curTextEvent == null || (evt != curTextEvent && evt.StartSample > curTextEvent.StartSample)) { string text = evt.GetTextValue(); Debug.Log(text); if (text == "left") { spawnRend.sharedMaterial = green; Invoke("Green", moveTime); } else if (text == "right") { spawnRend.sharedMaterial = yellow; Invoke("Yellow", moveTime); } else { spawnRend.sharedMaterial = red; Invoke("Red", moveTime); } cubeSpawn.createCube(text); // Store for later comparison. curTextEvent = evt; } // Clear out the text if our event ended this musical frame. if (curTextEvent.EndSample < sampleTime) { // guiTextCom.text = string.Empty; // Remove so that the above timing logic works when the audio loops/jumps. curTextEvent = null; } } }