added sfx for fail & spawn
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user