Files
jeu-sans-image/Assets/Scripts/Trigger/Triggerable/TriggerableSound.cs
Banane_Rotative bda9e7283b Add: trigger system
Trigger system that can activate any event
2026-01-19 22:58:25 +01:00

26 lines
560 B
C#

using UnityEngine;
/// <summary>
/// A triggerable sound. Trigger plays the sound.
/// </summary>
public class TriggerableSound : ITriggerable
{
[SerializeField] AudioClip audioSource;
public override void Trigger()
{
if (audioSource != null)
{
SoundManager.Instance.PlaySoundAt(transform.position, audioSource);
}
}
public override void Trigger(Vector3 position)
{
if (audioSource != null)
{
SoundManager.Instance.PlaySoundAt(position, audioSource);
}
}
}