91f1b18771
- Add PlayOnTrigger method to AudioSystem for scheduling audio playback on music sync events (beat/bar/grid) - Rename ButtonInvoker to SetStateBind for better clarity - Update PlaySoundBind to support both direct playback and trigger-based playback with callback flags - Add CallbackFlags enum (MusicSyncBeat, MusicSyncBar, MusicSyncGrid) - Update Metronome demo to use new callback flag naming convention - Add test audio file sfx_notice_test.wav - Update scene UI to demonstrate PlayOnTrigger functionality
32 lines
836 B
C#
32 lines
836 B
C#
using OCES.Audio;
|
|
using UnityEngine;
|
|
|
|
namespace OCES
|
|
{
|
|
/// <summary>
|
|
/// Drag this component to any game object.
|
|
/// Then you will get a metronome :)
|
|
/// </summary>
|
|
public class Metronome : MonoBehaviour
|
|
{
|
|
void Start()
|
|
{
|
|
AudioSystem.Instance.OnBeat += u =>
|
|
{
|
|
AudioSystem.Instance.Play(52);
|
|
Debug.Log($"Container {u} is MusicSyncBeat");
|
|
};
|
|
AudioSystem.Instance.OnBar += u =>
|
|
{
|
|
AudioSystem.Instance.Play(53);
|
|
Debug.Log($"Container {u} is MusicSyncBar");
|
|
};
|
|
AudioSystem.Instance.OnGrid += u =>
|
|
{
|
|
AudioSystem.Instance.Play(54);
|
|
Debug.Log($"Container {u} is MusicSyncGrid");
|
|
};
|
|
}
|
|
}
|
|
}
|