some more puzzle sounds
This commit is contained in:
27
Assets/Station46/Scripts/ButtonSound.cs
Normal file
27
Assets/Station46/Scripts/ButtonSound.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using NaughtyAttributes;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Station46.Scripts
|
||||
{
|
||||
[RequireComponent(typeof(Button))]
|
||||
public class ButtonSound : MonoBehaviour
|
||||
{
|
||||
[BoxGroup("Internal")] public AudioSource audioSource;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
audioSource.loop = false;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
GetComponent<Button>().ButtonEvent += (_, type) =>
|
||||
{
|
||||
if (type == ButtonEventType.Pressed)
|
||||
{
|
||||
audioSource.Play();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Station46/Scripts/ButtonSound.cs.meta
Normal file
3
Assets/Station46/Scripts/ButtonSound.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d6481047d71944108dc1d729ad344648
|
||||
timeCreated: 1684240044
|
||||
Reference in New Issue
Block a user