Voiceline adding logic, fmod asset folder cleaning, fmod tweaks

This commit is contained in:
Timur Nizamov
2026-01-15 22:25:02 +02:00
parent 91275418e4
commit 641fe43472
278 changed files with 1450 additions and 280 deletions

View File

@@ -63,11 +63,6 @@ public class AudioManager : MonoBehaviour
// public static AudioManager instance;
private static EventInstance musicEventInstance;
// ===== Dialogue / Programmer Sounds =====
[SerializeField]
private EventReference dialogueEvent;
private EVENT_CALLBACK dialogueCallback;
// public access for the Singleton
@@ -289,26 +284,47 @@ public class AudioManager : MonoBehaviour
//=====//
//=====//
public void PlayDialogue(string audioTableKey)
public void PlayDialogue(string audioTableKey, GameObject emitter = null)
{
if (!dialogueEvent.IsNull)
{
EventInstance instance = RuntimeManager.CreateInstance(dialogueEvent);
// Pin the string so FMOD can read it safely
GCHandle stringHandle = GCHandle.Alloc(audioTableKey);
instance.setUserData(GCHandle.ToIntPtr(stringHandle));
var dialogueEvent = FMODEvents.Instance.VoiceoverAll;
instance.setCallback(dialogueCallback);
instance.start();
instance.release();
}
else
if (dialogueEvent.IsNull)
{
Debug.LogWarning("Dialogue EventReference is not assigned!");
return;
}
EventInstance instance = RuntimeManager.CreateInstance(dialogueEvent);
if (emitter != null)
{
RuntimeManager.AttachInstanceToGameObject(instance, emitter);
instance.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(emitter.gameObject));
}
// Pin the key for programmer sound callback
GCHandle stringHandle = GCHandle.Alloc(audioTableKey);
instance.setUserData(GCHandle.ToIntPtr(stringHandle));
// Set the callback for programmer sounds
instance.setCallback(dialogueCallback);
// Add occlusion if available on the emitter
if (emitter != null)
{
FirstPersonOcclusion occlusion = emitter.GetComponent<FirstPersonOcclusion>();
if (occlusion != null)
{
occlusion.InitialiseWithInstance(instance);
}
}
instance.start();
instance.release();
}
[AOT.MonoPInvokeCallback(typeof(EVENT_CALLBACK))]
private static FMOD.RESULT DialogueEventCallback(
EVENT_CALLBACK_TYPE type,