forked from cgvr/DeltaVR
test boxes change colours based on progress
This commit is contained in:
@@ -9,8 +9,10 @@ public class VoiceTranscriptionTestBox : MonoBehaviour
|
||||
{
|
||||
public Material activeMaterial;
|
||||
public Material inactiveMaterial;
|
||||
public Material loadingMaterial;
|
||||
|
||||
private MeshRenderer meshRenderer;
|
||||
private bool isLoading;
|
||||
|
||||
|
||||
public WhisperManager whisper;
|
||||
@@ -22,6 +24,8 @@ public class VoiceTranscriptionTestBox : MonoBehaviour
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
isLoading = false;
|
||||
|
||||
whisper.OnNewSegment += OnNewSegment;
|
||||
whisper.OnProgress += OnProgressHandler;
|
||||
|
||||
@@ -42,6 +46,11 @@ public class VoiceTranscriptionTestBox : MonoBehaviour
|
||||
|
||||
void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (isLoading)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
KbmController controller = other.GetComponent<KbmController>();
|
||||
XROrigin playerOrigin = other.GetComponent<XROrigin>();
|
||||
if (controller != null || playerOrigin != null)
|
||||
@@ -57,8 +66,9 @@ public class VoiceTranscriptionTestBox : MonoBehaviour
|
||||
XROrigin playerOrigin = other.GetComponent<XROrigin>();
|
||||
if (controller != null | playerOrigin != null)
|
||||
{
|
||||
meshRenderer.material = inactiveMaterial;
|
||||
microphoneRecord.StopRecord();
|
||||
meshRenderer.material = loadingMaterial;
|
||||
isLoading = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,6 +92,9 @@ public class VoiceTranscriptionTestBox : MonoBehaviour
|
||||
|
||||
currentTextOutput = text;
|
||||
outputText.text = text;
|
||||
|
||||
meshRenderer.material = inactiveMaterial;
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private void OnProgressHandler(int progress)
|
||||
|
||||
Reference in New Issue
Block a user