您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
28 行
677 B
28 行
677 B
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class MusicPlayer : MonoBehaviour
|
|
{
|
|
[SerializeField] private VoidEventChannelSO _onSceneReady = default;
|
|
[SerializeField] private AudioCueEventChannelSO _playMusicOn = default;
|
|
[SerializeField] private GameSceneSO _thisSceneSO = default;
|
|
[SerializeField] private AudioConfigurationSO _audioConfig = default;
|
|
|
|
private void OnEnable()
|
|
{
|
|
_onSceneReady.OnEventRaised += PlayMusic;
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
_onSceneReady.OnEventRaised -= PlayMusic;
|
|
}
|
|
|
|
private void PlayMusic()
|
|
{
|
|
_playMusicOn.RaisePlayEvent(_thisSceneSO.musicTrack, _audioConfig);
|
|
|
|
}
|
|
}
|