813f4254c9
- 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
25 lines
612 B
C#
25 lines
612 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using OCES.Audio;
|
|
using UnityEngine;
|
|
using UnityEngine.Serialization;
|
|
using UnityEngine.UI;
|
|
|
|
public class PlaySoundBind : MonoBehaviour
|
|
{
|
|
public CallbackFlags callbackFlags;
|
|
public InputField inputField;
|
|
|
|
public void PlaySound()
|
|
{
|
|
uint.TryParse(this.inputField.text, out uint audioId);
|
|
AudioSystem.Instance.Play(audioId);
|
|
}
|
|
|
|
public void PlaySoundOnTrigger()
|
|
{
|
|
uint.TryParse(this.inputField.text, out uint audioId);
|
|
AudioSystem.Instance.PlayOnTrigger(audioId, this.callbackFlags);
|
|
}
|
|
}
|