1
0
forked from cgvr/DeltaVR

FMODi paigaldamine projekti sisse, fmod project created, assets are imported into FMOD; AudioManager and FMODEvents scripts, VR is set up

This commit is contained in:
Timur Nizamov
2025-10-12 20:57:56 +03:00
parent cb73b9cbbc
commit f542c4c57e
770 changed files with 47580 additions and 3 deletions

View File

@@ -0,0 +1,56 @@
using System;
using UnityEngine;
using UnityEngine.Serialization;
namespace FMODUnity
{
[AddComponentMenu("FMOD Studio/FMOD Studio Global Parameter Trigger")]
public class StudioGlobalParameterTrigger: EventHandler
{
[ParamRef]
[FormerlySerializedAs("parameter")]
public string Parameter;
public EmitterGameEvent TriggerEvent;
[FormerlySerializedAs("value")]
public float Value;
private FMOD.Studio.PARAMETER_DESCRIPTION parameterDescription;
public FMOD.Studio.PARAMETER_DESCRIPTION ParameterDescription { get { return parameterDescription; } }
protected override void HandleGameEvent(EmitterGameEvent gameEvent)
{
if (TriggerEvent == gameEvent)
{
TriggerParameters();
}
}
public void TriggerParameters()
{
bool paramNameSpecified = !string.IsNullOrEmpty(Parameter);
if (paramNameSpecified)
{
FMOD.RESULT result = FMOD.RESULT.OK;
bool paramIDNeedsLookup = string.IsNullOrEmpty(parameterDescription.name);
if (paramIDNeedsLookup)
{
result = RuntimeManager.StudioSystem.getParameterDescriptionByName(Parameter, out parameterDescription);
if (result != FMOD.RESULT.OK)
{
RuntimeUtils.DebugLogError(string.Format(("[FMOD] StudioGlobalParameterTrigger failed to lookup parameter {0} : result = {1}"), Parameter, result));
return;
}
}
result = RuntimeManager.StudioSystem.setParameterByID(parameterDescription.id, Value);
if (result != FMOD.RESULT.OK)
{
RuntimeUtils.DebugLogError(string.Format(("[FMOD] StudioGlobalParameterTrigger failed to set parameter {0} : result = {1}"), Parameter, result));
return;
}
}
}
}
}