feat: add PlayOnTrigger for music-synced audio playback
- 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
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using OCES.Audio;
|
||||
using UnityEngine.Audio;
|
||||
|
||||
namespace OCES
|
||||
{
|
||||
public class SetStateBind : MonoBehaviour
|
||||
{
|
||||
public GameState targetGameState;
|
||||
public bool enableLowpass;
|
||||
public Text buttonText;
|
||||
|
||||
Button m_button;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
this.buttonText.text = this.buttonText.text.Replace("PlaceHolder", this.targetGameState.ToString());
|
||||
}
|
||||
|
||||
|
||||
public void OnButtonPressed()
|
||||
{
|
||||
AudioSystem.Instance.SetState(this.targetGameState);
|
||||
|
||||
AudioSystem.Instance.SetLowpass(this.enableLowpass);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user