Skip to content

Commit 47b103d

Browse files
committed
Audio config setter for cutscene volume added
1 parent 0596b57 commit 47b103d

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
5+
public class CutsceneAudioConfigSetter : MonoBehaviour
6+
{
7+
[SerializeField] private AudioConfigurationSO _audioConfig = default;
8+
[SerializeField] private VoidEventChannelSO onCutsceneStart = default;
9+
10+
private void OnEnable()
11+
{
12+
onCutsceneStart.OnEventRaised += SetVolume;
13+
}
14+
15+
private void OnDestroy()
16+
{
17+
onCutsceneStart.OnEventRaised -= SetVolume;
18+
}
19+
20+
private void SetVolume()
21+
{
22+
GetComponent<AudioSource>().volume = _audioConfig.Volume;
23+
}
24+
}

UOP1_Project/Assets/CutsceneAudioConfigSetter.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)