Files

33 lines
1.0 KiB
C#

using OCES.Haptic;
using UnityEngine;
namespace OCES.Audio
{
public partial class AudioSystem
{
partial void OnAwakeComplete()
{
this.m_sfxSystem.OnSoundStarted += activeSound =>
{
uint hapticId = activeSound.AudioObject.Haptic;
if (hapticId == 0) return;
if (activeSound.AudioObject.ContainerType == ContainerType.Blend && activeSound.AudioObject.Haptic > 0)
{
Debug.LogWarning($"[Haptic System] Blend container {activeSound.AudioObject.Id} should not have haptic feedback!");
return;
}
HapticSystem.Instance.Play(hapticId, isDirectCall: false);
};
this.m_sfxSystem.OnSoundStopped += activeSound =>
{
uint hapticId = activeSound.AudioObject.Haptic;
if (hapticId == 0) return;
HapticSystem.Instance.Stop(hapticId);
};
}
}
}