浏览代码

Audio config setter for cutscene volume added

/main
Amel 3 年前
当前提交
af96b762
共有 2 个文件被更改,包括 35 次插入0 次删除
  1. 24
      UOP1_Project/Assets/CutsceneAudioConfigSetter.cs
  2. 11
      UOP1_Project/Assets/CutsceneAudioConfigSetter.cs.meta

24
UOP1_Project/Assets/CutsceneAudioConfigSetter.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CutsceneAudioConfigSetter : MonoBehaviour
{
[SerializeField] private AudioConfigurationSO _audioConfig = default;
[SerializeField] private VoidEventChannelSO onCutsceneStart = default;
private void OnEnable()
{
onCutsceneStart.OnEventRaised += SetVolume;
}
private void OnDestroy()
{
onCutsceneStart.OnEventRaised -= SetVolume;
}
private void SetVolume()
{
GetComponent<AudioSource>().volume = _audioConfig.Volume;
}
}

11
UOP1_Project/Assets/CutsceneAudioConfigSetter.cs.meta


fileFormatVersion: 2
guid: 59a218b6814165f4e9c265df3d7aa5dc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存