add sound effects to button, mic stand, model generation, shape scanner
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using FMOD.Studio;
|
||||
|
||||
public class ArcheryRangeModelGenerationController : MonoBehaviour
|
||||
{
|
||||
@@ -20,6 +21,7 @@ public class ArcheryRangeModelGenerationController : MonoBehaviour
|
||||
public Material wireActiveMaterial;
|
||||
|
||||
private bool modelGenerationInProgress;
|
||||
private EventInstance printingSound;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
@@ -27,6 +29,9 @@ public class ArcheryRangeModelGenerationController : MonoBehaviour
|
||||
imageGenerationButton.OnButtonPressed += InvokeImageGeneration;
|
||||
modelGenerationButton.OnButtonPressed += InvokeModelGeneration;
|
||||
modelGenerationInProgress = false;
|
||||
|
||||
printingSound = AudioManager.Instance.CreateInstance(FMODEvents.Instance.Printing);
|
||||
printingSound.setParameterByName("3DPrinterPrintingJob", 1);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
@@ -56,6 +61,10 @@ public class ArcheryRangeModelGenerationController : MonoBehaviour
|
||||
private async void InvokeModelGeneration()
|
||||
{
|
||||
modelGenerationInProgress = true;
|
||||
|
||||
printingSound.start();
|
||||
printingSound.setParameterByName("3DPrinterPrintingJob", 0);
|
||||
|
||||
string encodedTexture = Convert.ToBase64String(GeneratedTexture.EncodeToJPG());
|
||||
byte[] encodedModel = await TrellisClient.Instance.GenerateModel(encodedTexture);
|
||||
|
||||
@@ -66,6 +75,8 @@ public class ArcheryRangeModelGenerationController : MonoBehaviour
|
||||
spawnedObject.transform.position = modelDisplay.position;
|
||||
GeneratedModel = spawnedObject;
|
||||
|
||||
printingSound.setParameterByName("3DPrinterPrintingJob", 1);
|
||||
|
||||
OnModelReady();
|
||||
modelGenerationButton.Deactivate();
|
||||
modelGenerationInProgress = false;
|
||||
@@ -79,5 +90,6 @@ public class ArcheryRangeModelGenerationController : MonoBehaviour
|
||||
}
|
||||
|
||||
modelDisplay.GetComponent<MeshRenderer>().material = modelDisplayActiveMaterial;
|
||||
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.ShapeScannerSuccess, gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ public class MicrophoneStand : MonoBehaviour
|
||||
{
|
||||
microphoneOffStatus.SetActive(false);
|
||||
microphoneOnStatus.SetActive(true);
|
||||
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.RadioButton, gameObject);
|
||||
fmodWhisperBridge.ActivateRecording();
|
||||
}
|
||||
}
|
||||
@@ -45,6 +46,7 @@ public class MicrophoneStand : MonoBehaviour
|
||||
{
|
||||
microphoneOffStatus.SetActive(true);
|
||||
microphoneOnStatus.SetActive(false);
|
||||
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.RadioButton, gameObject);
|
||||
fmodWhisperBridge.DeactivateRecording();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ public class PushableButton : MonoBehaviour
|
||||
{
|
||||
movableParts.DOLocalMoveY(downPositionY, moveDuration);
|
||||
isButtonDown = true;
|
||||
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.Click, gameObject);
|
||||
|
||||
if (wire != null)
|
||||
{
|
||||
@@ -71,6 +72,7 @@ public class PushableButton : MonoBehaviour
|
||||
{
|
||||
movableParts.DOLocalMoveY(upPositionY, moveDuration);
|
||||
isButtonDown = false;
|
||||
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.Click, gameObject);
|
||||
|
||||
if (wire != null)
|
||||
{
|
||||
|
||||
@@ -97,6 +97,8 @@ public class ShapeScanner : MonoBehaviour
|
||||
rayCount = configuration.rows.SelectMany(row => row.cells).Count();
|
||||
correctRayStates = configuration.rows.SelectMany(row => row.cells).Count(cell => !cell);
|
||||
UpdateDisplay(calculateCorrectPercentage());
|
||||
|
||||
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.ShapeScannerSuccess, gameObject);
|
||||
}
|
||||
|
||||
private float calculateCorrectPercentage()
|
||||
|
||||
Reference in New Issue
Block a user