Skip to content

Commit 6c7ce38

Browse files
authored
feat: add ambiance types (#42)
1 parent 314ca47 commit 6c7ce38

15 files changed

+233
-122
lines changed

Assets/Audio/Ambiance.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using Framework;
2+
using UnityEngine;
3+
4+
namespace Audio.Ambiance {
5+
public class AmbianceSetter : MonoBehaviour {
6+
[SerializeField] private AmbianceType _ambianceType;
7+
8+
private void Awake() {
9+
App.Audio.SetAmbiance(_ambianceType);
10+
}
11+
}
12+
}

Assets/Audio/Ambiance/AmbianceSetter.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
using UnityEngine;
2+
3+
namespace Audio.Ambiance {
4+
public class AmbianceType : ScriptableObject {
5+
public int Value;
6+
}
7+
}

Assets/Audio/Ambiance/AmbianceType.cs.meta

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

Assets/Audio/Ambiance/LoadingDocsAmbiance.asset

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

Assets/Audio/Ambiance/LoadingDocsAmbiance.asset.meta

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

Assets/Audio/Ambiance/MainMenuAmbiance.asset

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

Assets/Audio/Ambiance/MainMenuAmbiance.asset.meta

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

Assets/Audio/AudioManager.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using FMOD.Studio;
1+
using Audio.Ambiance;
2+
using FMOD.Studio;
23
using FMODUnity;
34
using Settings.Bundles;
45
using UnityEngine;
@@ -37,10 +38,9 @@ private void OnDisable() {
3738
_bundle.MusicVolume.Changed -= HandleMusicVolumeChanged;
3839
}
3940

40-
public void PlayAmbience() {
41+
public void SetAmbiance(AmbianceType ambianceType) {
4142
if (_ambienceAudio.IsInitialized) {
42-
_ambienceSceneParam.CurrentValue =
43-
SceneManager.GetActiveScene().buildIndex;
43+
_ambienceSceneParam.CurrentValue = ambianceType.Value;
4444
_ambienceAudio.Instance.getPlaybackState(out var state);
4545
if (state == PLAYBACK_STATE.STOPPED) {
4646
_ambienceAudio.Play();

0 commit comments

Comments
 (0)