1
0
forked from cgvr/DeltaVR

test boxes change colours based on progress

This commit is contained in:
2025-12-16 10:43:58 +02:00
parent 5956b9508d
commit 32a5e4f332
5 changed files with 166 additions and 16 deletions

View File

@@ -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)