35 lines
596 B
C#
35 lines
596 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class AudioHolder : MonoBehaviour
|
|
{
|
|
|
|
AudioSource SoundEmitter;
|
|
|
|
private void OnEnable()
|
|
{
|
|
// Add delegate
|
|
Trigger.OnGlassTriggered += PlaySound;
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
// Remove delegate
|
|
Trigger.OnGlassTriggered += PlaySound;
|
|
}
|
|
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
SoundEmitter = GetComponent<AudioSource>();
|
|
}
|
|
|
|
|
|
private void PlaySound()
|
|
{
|
|
SoundEmitter.Play();
|
|
}
|
|
|
|
}
|