Skip to content

Commit

Permalink
feat: add ambiance types (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
aarthificial authored Sep 24, 2023
1 parent 314ca47 commit 6c7ce38
Show file tree
Hide file tree
Showing 15 changed files with 233 additions and 122 deletions.
3 changes: 3 additions & 0 deletions Assets/Audio/Ambiance.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions Assets/Audio/Ambiance/AmbianceSetter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Framework;
using UnityEngine;

namespace Audio.Ambiance {
public class AmbianceSetter : MonoBehaviour {
[SerializeField] private AmbianceType _ambianceType;

private void Awake() {
App.Audio.SetAmbiance(_ambianceType);
}
}
}
3 changes: 3 additions & 0 deletions Assets/Audio/Ambiance/AmbianceSetter.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Assets/Audio/Ambiance/AmbianceType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using UnityEngine;

namespace Audio.Ambiance {
public class AmbianceType : ScriptableObject {
public int Value;
}
}
3 changes: 3 additions & 0 deletions Assets/Audio/Ambiance/AmbianceType.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions Assets/Audio/Ambiance/LoadingDocsAmbiance.asset

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/Audio/Ambiance/LoadingDocsAmbiance.asset.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions Assets/Audio/Ambiance/MainMenuAmbiance.asset

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/Audio/Ambiance/MainMenuAmbiance.asset.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Assets/Audio/AudioManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using FMOD.Studio;
using Audio.Ambiance;
using FMOD.Studio;
using FMODUnity;
using Settings.Bundles;
using UnityEngine;
Expand Down Expand Up @@ -37,10 +38,9 @@ private void OnDisable() {
_bundle.MusicVolume.Changed -= HandleMusicVolumeChanged;
}

public void PlayAmbience() {
public void SetAmbiance(AmbianceType ambianceType) {
if (_ambienceAudio.IsInitialized) {
_ambienceSceneParam.CurrentValue =
SceneManager.GetActiveScene().buildIndex;
_ambienceSceneParam.CurrentValue = ambianceType.Value;
_ambienceAudio.Instance.getPlaybackState(out var state);
if (state == PLAYBACK_STATE.STOPPED) {
_ambienceAudio.Play();
Expand Down
16 changes: 14 additions & 2 deletions Assets/Framework/StoryBundle.prefab

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Assets/Framework/StoryState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public void Pause() {
public void Resume() {
Assert.IsTrue(IsActive);

App.Audio.PlayAmbience();
App.Input.SwitchToGameplay();
IsPaused = false;
Time.timeScale = 1;
Expand Down
84 changes: 45 additions & 39 deletions Assets/Scenes/Intro/EntryGate.unity

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6c7ce38

Please sign in to comment.