wip : still trying to make functions transition with audio
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class Audio_PersistentManager : MonoBehaviour
|
||||
{
|
||||
public static Audio_PersistentManager Instance { get; private set; }
|
||||
|
||||
void Awake()
|
||||
{
|
||||
// If an instance already exists and it's not this one, destroy this duplicate
|
||||
if (Instance != null && Instance != this)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
|
||||
Instance = this;
|
||||
DontDestroyOnLoad(gameObject);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 020f1ac3c4ebf6e49b89ba31175bb728
|
||||
@@ -0,0 +1,35 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class MusicCueLogger : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private AK.Wwise.Event musicEvent;
|
||||
|
||||
private uint _playingId;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_playingId = musicEvent.Post(
|
||||
gameObject,
|
||||
(uint)AkCallbackType.AK_MusicSyncUserCue,
|
||||
OnMusicSync
|
||||
);
|
||||
}
|
||||
|
||||
private void OnMusicSync(object in_cookie, AkCallbackType in_type, AkCallbackInfo in_info)
|
||||
{
|
||||
if (in_type != AkCallbackType.AK_MusicSyncUserCue)
|
||||
return;
|
||||
|
||||
var cueInfo = in_info as AkMusicSyncCallbackInfo;
|
||||
if (cueInfo == null)
|
||||
return;
|
||||
|
||||
Debug.Log($"[MusicCueLogger] Cue reached: {cueInfo.userCueName}");
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (_playingId != AkUnitySoundEngine.AK_INVALID_PLAYING_ID)
|
||||
AkUnitySoundEngine.StopPlayingID(_playingId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a8c7b417b385a5b4babca499ff6b8a68
|
||||
Reference in New Issue
Block a user