Browse Source

added sfx for fail & spawn

audio
cailean 6 months ago
parent
commit
7934c4d031
  1. 6
      Assets/3_MarathonEnvs/Scripts/Ragdoll004/RagDollAgent.cs
  2. 46
      Assets/5_Scenes/DreconDemo.unity
  3. 28
      Assets/8_Scripts/1_Managers/AgentManager.cs
  4. 7
      Assets/8_Scripts/1_Managers/AudioManager.cs
  5. 2
      Assets/ML-Agents/Timers/DreconDemo_timers.json
  6. 2
      Assets/Plugins/FMOD/Resources/FMODStudioSettings.asset
  7. BIN
      FMOD Banks/Desktop/Master.strings.bank
  8. BIN
      FMOD Banks/Desktop/SFX.bank

6
Assets/3_MarathonEnvs/Scripts/Ragdoll004/RagDollAgent.cs

@ -70,6 +70,9 @@ public class RagDollAgent : Agent
public delegate void OnMoveToNextModelDelegate();
public static OnMoveToNextModelDelegate m_MoveToNextModel;
public delegate void OnAgentFailDelegate();
public static OnAgentFailDelegate m_AgentFail;
void Awake()
{
if (RequestCamera && CameraTarget != null)
@ -238,10 +241,13 @@ public class RagDollAgent : Agent
m_Temp = m_TerrainCollider.excludeLayers;
m_TerrainCollider.excludeLayers = m_ExcludeLayer;
}
m_AgentFail?.Invoke();
}
timer += Time.fixedDeltaTime;
if (timer >= waitTime)
{
timer = 0;

46
Assets/5_Scenes/DreconDemo.unity

@ -918,7 +918,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 320225263}
serializedVersion: 2
m_LocalRotation: {x: 0.38916615, y: 0.59320796, z: -0.58294386, w: 0.3960183}
m_LocalRotation: {x: 0.3891641, y: 0.5932094, z: -0.5829452, w: 0.3960163}
m_LocalPosition: {x: 17.78, y: 21.78, z: 3.06}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -1000,7 +1000,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 326736459}
serializedVersion: 2
m_LocalRotation: {x: -0.073961094, y: 0.9066138, z: 0.17882526, w: 0.3749702}
m_LocalRotation: {x: -0.07396109, y: 0.9066138, z: 0.17882524, w: 0.37497023}
m_LocalPosition: {x: 17.7008, y: 8.655965, z: -0.081218004}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -1188,11 +1188,11 @@ Camera:
y: 0
width: 1
height: 1
near clip plane: 0.1
near clip plane: 0.01
far clip plane: 5000
field of view: 40
orthographic: 1
orthographic size: -0.34
field of view: 31.1
orthographic: 0
orthographic size: 0.53
m_Depth: -1
m_CullingMask:
serializedVersion: 2
@ -1216,8 +1216,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 330585543}
serializedVersion: 2
m_LocalRotation: {x: 0.38916615, y: 0.59320796, z: -0.58294386, w: 0.3960183}
m_LocalPosition: {x: 17.78, y: 21.78, z: 3.06}
m_LocalRotation: {x: -0.254152, y: 0.69070727, z: -0.6135771, w: -0.28610036}
m_LocalPosition: {x: 22.891924, y: 9.244215, z: 4.6990404}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@ -2896,6 +2896,28 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 8c398b676a196214e9a3612ad50bcd56, type: 3}
m_Name:
m_EditorClassIdentifier:
m_BreathingSFX:
Guid:
Data1: -1481242929
Data2: 1169120624
Data3: 1069960612
Data4: -1923918508
Path: event:/Breathing
m_RespawnSFX:
Guid:
Data1: -1445541287
Data2: 1175949567
Data3: -1595752824
Data4: 741168962
Path: event:/Respawn
m_FailSFX:
Guid:
Data1: 686795103
Data2: 1316461712
Data3: -1064634706
Data4: 766062146
Path: event:/Fail
m_Agent: {fileID: 1519799410}
--- !u!1 &882491594
GameObject:
m_ObjectHideFlags: 0
@ -3003,7 +3025,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 882491594}
serializedVersion: 2
m_LocalRotation: {x: 0.49182287, y: 0.0021121474, z: -0.001193077, w: 0.8706919}
m_LocalRotation: {x: 0.49182287, y: 0.0021121174, z: -0.00119306, w: 0.8706919}
m_LocalPosition: {x: 18.100853, y: 10.155965, z: -0.48116565}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -4504,6 +4526,12 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1519799410 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 3332260817411020948, guid: 248e74dcdf41731459e829be7f230e47,
type: 3}
m_PrefabInstance: {fileID: 5430993456058346333}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1531711171
GameObject:
m_ObjectHideFlags: 3

28
Assets/8_Scripts/1_Managers/AgentManager.cs

@ -5,15 +5,27 @@ using UnityEngine;
public class AgentManager : MonoBehaviour
{
[SerializeField]
public EventReference m_BreathingSFX;
public EventReference m_RespawnSFX;
public EventReference m_FailSFX;
public GameObject m_Agent;
private void OnEnable()
{
CollisionDetection.m_PlaySoundOnContact += PlayOneShot;
RagDollAgent.m_MoveToNextModel += PlayRespawnSFX;
RagDollAgent.m_AgentFail += PlayAgentFail;
}
private void OnDisable()
{
CollisionDetection.m_PlaySoundOnContact -= PlayOneShot;
RagDollAgent.m_MoveToNextModel -= PlayRespawnSFX;
RagDollAgent.m_AgentFail -= PlayAgentFail;
}
private void Start()
{
PlayBreathing(m_Agent, m_BreathingSFX);
}
private void PlayOneShot(GameObject obj, float force, EventReference sound)
@ -21,4 +33,18 @@ public class AgentManager : MonoBehaviour
AudioManager.instance.PlayOneShotAttached(sound, obj, force);
}
private void PlayBreathing(GameObject obj, EventReference sound)
{
AudioManager.instance.PlayOneShotAttachedBreathing(sound, obj, 1);
}
private void PlayRespawnSFX()
{
AudioManager.instance.PlaySound(m_RespawnSFX);
}
private void PlayAgentFail()
{
AudioManager.instance.PlaySound(m_FailSFX);
}
}

7
Assets/8_Scripts/1_Managers/AudioManager.cs

@ -26,7 +26,7 @@ public class AudioManager : MonoBehaviour
{
if (!m_Soundtrack.IsNull)
{
RuntimeManager.PlayOneShot(m_Soundtrack);
//RuntimeManager.PlayOneShot(m_Soundtrack);
}
}
@ -43,6 +43,11 @@ public class AudioManager : MonoBehaviour
RuntimeManager.PlayOneShotAttached(sound, obj, force, 0.1f);
}
public void PlayOneShotAttachedBreathing(EventReference sound, GameObject obj, float force)
{
RuntimeManager.PlayOneShotAttached(sound, obj, force, 0.3f);
}
public void StopSound(EventInstance soundInst)
{
soundInst.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);

2
Assets/ML-Agents/Timers/DreconDemo_timers.json

@ -1 +1 @@
{"count":1,"self":57.1685376,"total":58.9029435,"children":{"InitializeActuators":{"count":1,"self":0.0009961,"total":0.0009961,"children":null},"InitializeSensors":{"count":1,"self":0.0015038,"total":0.0015038,"children":null},"AgentSendState":{"count":3077,"self":0.0150424,"total":0.5569085,"children":{"CollectObservations":{"count":1539,"self":0.3906794,"total":0.3906794,"children":null},"WriteActionMask":{"count":1539,"self":0.0039163,"total":0.0039163,"children":null},"RequestDecision":{"count":1539,"self":0.1472704,"total":0.1472704,"children":null}}},"DecideAction":{"count":3077,"self":0.64407969999999992,"total":0.64407969999999992,"children":null},"AgentAct":{"count":3077,"self":0.5309171,"total":0.5309171,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1714393193","unity_version":"2022.3.5f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2022.3.5f1\\Editor\\Unity.exe -projectpath C:\\Users\\caile\\Desktop\\Projects\\24_3-Moloch\\2_Unity\\Expeirments\\Drecon2022 -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-caile -hubSessionId 9b433f92-5c93-446a-923f-743ea7173ebf -accessToken EpS5BrO4ecWgDnIKinrxODUmKDNMMpqYHpQjzvf9aho005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"DreconDemo","end_time_seconds":"1714393252"}}
{"count":1,"self":128.1924096,"total":131.9344607,"children":{"InitializeActuators":{"count":1,"self":0.0009985,"total":0.0009985,"children":null},"InitializeSensors":{"count":1,"self":0,"total":0,"children":null},"AgentSendState":{"count":7551,"self":0.0385919,"total":0.95429009999999992,"children":{"CollectObservations":{"count":3776,"self":0.88619569999999992,"total":0.88619569999999992,"children":null},"WriteActionMask":{"count":3776,"self":0.0030057,"total":0.0030057,"children":null},"RequestDecision":{"count":3776,"self":0.026496799999999997,"total":0.026496799999999997,"children":null}}},"DecideAction":{"count":7551,"self":1.6056336,"total":1.6056336,"children":null},"AgentAct":{"count":7551,"self":1.1811269,"total":1.1811269,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1714401788","unity_version":"2022.3.5f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2022.3.5f1\\Editor\\Unity.exe -projectpath C:\\Users\\caile\\Desktop\\Projects\\24_3-Moloch\\2_Unity\\Expeirments\\Drecon2022 -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-caile -hubSessionId 9b433f92-5c93-446a-923f-743ea7173ebf -accessToken hVGdujk9CHader-8_mkV5GU4z8wakdPMsqR-_m_UC4Q005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"DreconDemo","end_time_seconds":"1714401920"}}

2
Assets/Plugins/FMOD/Resources/FMODStudioSettings.asset

@ -457,7 +457,7 @@ MonoBehaviour:
sourceBankPath: FMOD Banks/Desktop
sourceBankPathUnformatted:
BankRefreshCooldown: 5
ShowBankRefreshWindow: 1
ShowBankRefreshWindow: 0
AutomaticEventLoading: 1
BankLoadType: 0
AutomaticSampleLoading: 0

BIN
FMOD Banks/Desktop/Master.strings.bank

Binary file not shown.

BIN
FMOD Banks/Desktop/SFX.bank

Binary file not shown.
Loading…
Cancel
Save