1
0
forked from cgvr/DeltaVR

add sound effects to button, mic stand, model generation, shape scanner

This commit is contained in:
2026-01-25 15:10:42 +02:00
parent 75bd66fc36
commit ec45c402af
8 changed files with 32 additions and 4 deletions

View File

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