forked from cgvr/DeltaVR
archery range mic emits particles + recording is clearer to player
This commit is contained in:
@@ -6,21 +6,20 @@
|
||||
* speech-to-text:
|
||||
* uurida miks buildis Whisper halvemini töötab
|
||||
* proovida suuremat Whisperi mudelit, äkki töötab mürases keskkonnas paremini
|
||||
* igal pool, kus mängija peab rääkima, peaks olema:
|
||||
* helilained räägitava heli amplituudi põhjal
|
||||
* "loading" dünaamiline ikoon kui mängija ootab protsessimise järel
|
||||
* npc character:
|
||||
* klaas on näha temast eespool
|
||||
* voicelines: list listidest, mille hulgast saab valida
|
||||
* shape detection:
|
||||
* professor võiks öelda "good job, continue..." pärast esimest successi
|
||||
* kui kõik configurationid tehtud, siis professor ütleb "thank you"
|
||||
* particle effectid 3d printerile
|
||||
* particle effectid shape scannerile, kui config success
|
||||
* peab mängijale kuidagi selgitama, kuidas scale'ida prinditud objekte
|
||||
* prinditud objekti scale'imisele min ja max size limiit
|
||||
* archery range:
|
||||
* mikrofon peaks lõpetama protsessimise ka siis kui mängija läheb ära mikri juurest
|
||||
* võiks jääda kordama viimast instruktsiooni, kui mängija ei progressi edasi
|
||||
* kui archery range läbi, võiks npc öelda "good job, try again..."
|
||||
* particle effectid model display'le
|
||||
* kui midagi laeb (wire aktiivne), siis particle'id võiks voolata mööda toru
|
||||
* highscore json tühjaks
|
||||
* cafe:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -10,58 +10,72 @@ public class MicrophoneStand : MonoBehaviour
|
||||
|
||||
public FMODWhisperBridge fmodWhisperBridge;
|
||||
|
||||
public delegate void OnPlayerFinishedSpeakingDelegate();
|
||||
public event OnPlayerFinishedSpeakingDelegate OnPlayerFinishedSpeaking;
|
||||
public delegate void OnPlayerUsedMicrophoneDelegate();
|
||||
public event OnPlayerUsedMicrophoneDelegate OnPlayerUsedMicrophone;
|
||||
|
||||
[Header("Particle System Config")]
|
||||
public ParticleSystem particles;
|
||||
public float baseEmissionRate = 3;
|
||||
public float maxExtraEmissionRate = 50;
|
||||
|
||||
private ParticleSystem.EmissionModule particleEmission;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
microphoneOffStatus.SetActive(true);
|
||||
microphoneOnStatus.SetActive(false);
|
||||
|
||||
particleEmission = particles.emission;
|
||||
particleEmission.enabled = false;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
if (particleEmission.enabled)
|
||||
{
|
||||
particleEmission.rateOverTime = baseEmissionRate + fmodWhisperBridge.GetNormalizedVolume01() * maxExtraEmissionRate;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPlayerApproach()
|
||||
{
|
||||
fmodWhisperBridge.ActivateRecording();
|
||||
fmodWhisperBridge.OnWhisperSegmentUpdated += OnPlayerSpeechUpdated;
|
||||
fmodWhisperBridge.OnWhisperSegmentFinished += OnPlayerSpeechFinished;
|
||||
|
||||
microphoneOffStatus.SetActive(false);
|
||||
microphoneOnStatus.SetActive(true);
|
||||
particleEmission.enabled = true;
|
||||
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.RadioButton, gameObject);
|
||||
fmodWhisperBridge.ActivateRecording();
|
||||
}
|
||||
|
||||
public void OnPlayerLeave()
|
||||
{
|
||||
fmodWhisperBridge.OnWhisperSegmentUpdated -= OnPlayerSpeechUpdated;
|
||||
fmodWhisperBridge.OnWhisperSegmentFinished -= OnPlayerSpeechFinished;
|
||||
fmodWhisperBridge.DeactivateRecording();
|
||||
|
||||
microphoneOffStatus.SetActive(true);
|
||||
microphoneOnStatus.SetActive(false);
|
||||
particleEmission.enabled = false;
|
||||
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.RadioButton, gameObject);
|
||||
fmodWhisperBridge.DeactivateRecording();
|
||||
}
|
||||
|
||||
private void OnPlayerSpeechUpdated(string text)
|
||||
{
|
||||
outputText.text = text;
|
||||
OnPlayerFinishedSpeaking?.Invoke();
|
||||
OnPlayerUsedMicrophone?.Invoke();
|
||||
}
|
||||
|
||||
private void OnPlayerSpeechFinished(string playerText)
|
||||
private void OnPlayerSpeechFinished(string text)
|
||||
{
|
||||
OnPlayerFinishedSpeaking?.Invoke();
|
||||
outputText.text = text;
|
||||
OnPlayerUsedMicrophone?.Invoke();
|
||||
}
|
||||
|
||||
public string GetTextOutput()
|
||||
{
|
||||
return outputText.text;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class ArcheryRangeNPC : NPCController
|
||||
|
||||
private void Start()
|
||||
{
|
||||
microphoneStand.OnPlayerFinishedSpeaking += OnPlayerUsedMicrophone;
|
||||
microphoneStand.OnPlayerUsedMicrophone += OnPlayerUsedMicrophone;
|
||||
imageGenerationButton.OnButtonPressed += OnImageGenerationButtonPressed;
|
||||
modelGenerationButton.OnButtonPressed += OnModelGenerationButtonPressed;
|
||||
}
|
||||
|
||||
@@ -38,11 +38,9 @@ public class RadioTransmitter : XRGrabInteractable
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (particles.emission.enabled)
|
||||
if (particleEmission.enabled)
|
||||
{
|
||||
particles.transform.LookAt(computerScreen.transform.position);
|
||||
Debug.Log("speech volume normalized: " + fmodWhisperBridge.GetNormalizedVolume01());
|
||||
Debug.Log("speech volume decibels: " + fmodWhisperBridge.GetCurrentVolumeDb());
|
||||
particleEmission.rateOverTime = baseEmissionRate + fmodWhisperBridge.GetNormalizedVolume01() * maxExtraEmissionRate;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user