diff --git a/Assets/Scenes/Trailer_BG.unity b/Assets/Scenes/Trailer_BG.unity index 509ccc1c5642768e6dd753bbd64d04bda350333c..da0e67778cdb662a1868331947395e77cc28f252 100644 --- a/Assets/Scenes/Trailer_BG.unity +++ b/Assets/Scenes/Trailer_BG.unity @@ -1326,8 +1326,149 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: sceneBuildIndex: 0 - deathSpawnPoint: {fileID: 0} - player: {fileID: 4121029672727752963, guid: d99c2016aaf9e4e479ff6d9fe04f2813, type: 3} +--- !u!1 &1738744908 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1738744909} + - component: {fileID: 1738744910} + - component: {fileID: 1738744911} + m_Layer: 0 + m_Name: Audio Manager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1738744909 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1738744908} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 745.4615, y: 564.34045, z: -5.7037225} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 11 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1738744910 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1738744908} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d5b881f01a75b2744a6d0e018785708d, type: 3} + m_Name: + m_EditorClassIdentifier: + mainMenuTheme: {fileID: 8300000, guid: 2a335334d078b354aac4c691e44c9d37, type: 3} + gameTheme: {fileID: 8300000, guid: 9fdae846806a45a419a5b0b86db11fb2, type: 3} +--- !u!82 &1738744911 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1738744908} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 8300000, guid: 2a335334d078b354aac4c691e44c9d37, type: 3} + m_PlayOnAwake: 1 + m_Volume: 1 + m_Pitch: 1 + Loop: 1 + Mute: 0 + Spatialize: 0 + SpatializePostEffects: 0 + Priority: 128 + DopplerLevel: 1 + MinDistance: 1 + MaxDistance: 500 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 --- !u!1 &1798569351 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/Windfell Forest/Room 14.unity b/Assets/Scenes/Windfell Forest/Room 14.unity index c925c043a49d514e70de631e77eacb6fd476414c..f3b4eba8454c087fb8fd878d03f666d6322b7ed5 100644 --- a/Assets/Scenes/Windfell Forest/Room 14.unity +++ b/Assets/Scenes/Windfell Forest/Room 14.unity @@ -6625,6 +6625,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: d5b881f01a75b2744a6d0e018785708d, type: 3} m_Name: m_EditorClassIdentifier: + mainMenuTheme: {fileID: 8300000, guid: 2a335334d078b354aac4c691e44c9d37, type: 3} + gameTheme: {fileID: 8300000, guid: 9fdae846806a45a419a5b0b86db11fb2, type: 3} --- !u!4 &463640345 Transform: m_ObjectHideFlags: 0 @@ -6655,7 +6657,7 @@ AudioSource: m_Volume: 1 m_Pitch: 1 Loop: 1 - Mute: 1 + Mute: 0 Spatialize: 0 SpatializePostEffects: 0 Priority: 128 diff --git a/Assets/Scenes/Windfell Forest/Room 15.unity b/Assets/Scenes/Windfell Forest/Room 15.unity index 41425c0d79a6d6f34668d721f6593e288b215d05..16a1ad7c79e94f711c8e26832180d939d609c091 100644 --- a/Assets/Scenes/Windfell Forest/Room 15.unity +++ b/Assets/Scenes/Windfell Forest/Room 15.unity @@ -8317,7 +8317,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!82 &950142784 AudioSource: m_ObjectHideFlags: 0 @@ -8333,7 +8333,7 @@ AudioSource: m_Volume: 1 m_Pitch: 1 Loop: 1 - Mute: 1 + Mute: 0 Spatialize: 0 SpatializePostEffects: 0 Priority: 128 @@ -8426,6 +8426,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: d5b881f01a75b2744a6d0e018785708d, type: 3} m_Name: m_EditorClassIdentifier: + mainMenuTheme: {fileID: 0} + gameTheme: {fileID: 0} --- !u!4 &950142786 Transform: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/AudioManager.cs b/Assets/Scripts/AudioManager.cs index 63a558fa4f10bccdb15b444d7a73ddd59b7579b9..bae3840727567ea7ad95cd111f1308084a68172a 100644 --- a/Assets/Scripts/AudioManager.cs +++ b/Assets/Scripts/AudioManager.cs @@ -1,21 +1,82 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; +using UnityEngine.SceneManagement; public class AudioManager : MonoBehaviour { - private static AudioManager instance = null; + public AudioClip mainMenuTheme; + public AudioClip gameTheme; - private void Awake() + private static AudioManager instance = null; + private AudioSource audioSource; + + private void Awake() + { + if (instance == null) + { + instance = this; + DontDestroyOnLoad(gameObject); + } + else + { + Destroy(gameObject); + return; + } + + audioSource = GetComponent<AudioSource>(); + } + + private void Start() + { + SceneManager.sceneLoaded += OnSceneLoaded; + PlayCurrentSceneTheme(); + } + + private void OnDestroy() + { + SceneManager.sceneLoaded -= OnSceneLoaded; + } + + private void OnSceneLoaded(Scene scene, LoadSceneMode loadSceneMode) + { + string sceneName = scene.name; + + if (sceneName == "Trailer_BG") { - if (instance == null) + // Instantiate an Audio Source gameobject for the Main Menu theme + if (audioSource.clip != mainMenuTheme) { - instance = this; - DontDestroyOnLoad(gameObject); + audioSource.Stop(); + audioSource.clip = mainMenuTheme; + audioSource.Play(); } - else + } + else if (sceneName == "Room 14") + { + // Instantiate an Audio Source gameobject for the game theme + if (audioSource.clip != gameTheme) { - Destroy(gameObject); + audioSource.Stop(); + audioSource.clip = gameTheme; + audioSource.Play(); } } -} + } + + public void PlayCurrentSceneTheme() + { + string currentScene = SceneManager.GetActiveScene().name; + + if (currentScene == "Trailer_BG") + { + audioSource.clip = mainMenuTheme; + audioSource.Play(); + } + else if (currentScene == "Room 14") + { + audioSource.clip = gameTheme; + audioSource.Play(); + } + } +} \ No newline at end of file diff --git a/UserSettings/EditorUserSettings.asset b/UserSettings/EditorUserSettings.asset index 7917e068480e8d2e6af24a12b6ca9dfbf037183b..400d4dde7787dac479172de71d48405b3319f737 100644 --- a/UserSettings/EditorUserSettings.asset +++ b/UserSettings/EditorUserSettings.asset @@ -6,25 +6,25 @@ EditorUserSettings: serializedVersion: 4 m_ConfigSettings: RecentlyUsedSceneGuid-0: - value: 5309035456030c0a5858557047760d44464f1e727a2b71322b7d4966b6b63061 + value: 550107560650510f0e5d087043265e441215487b747c73362b714d37e7b76460 flags: 0 RecentlyUsedSceneGuid-1: - value: 550107560650510f0e5d087043265e441215487b747c73362b714d37e7b76460 + value: 0208515203505b0f5c58597345215d444f161e7e7c70233329281c37e6e4606f flags: 0 RecentlyUsedSceneGuid-2: - value: 0208515203505b0f5c58597345215d444f161e7e7c70233329281c37e6e4606f + value: 02085055510d505f0b5e5a734070094410154b7e757e76677c281c6be0b0356b flags: 0 RecentlyUsedSceneGuid-3: - value: 02085055510d505f0b5e5a734070094410154b7e757e76677c281c6be0b0356b + value: 0207025701040d5a585e097447755d4445151b282a7823327a791f66b5b46c3c flags: 0 RecentlyUsedSceneGuid-4: - value: 0207025701040d5a585e097447755d4445151b282a7823327a791f66b5b46c3c + value: 560502575d0d0f0c5f580e20427a0e44124f4e7f742b7f66287c4460e0e26d3e flags: 0 RecentlyUsedSceneGuid-5: - value: 560502575d0d0f0c5f580e20427a0e44124f4e7f742b7f66287c4460e0e26d3e + value: 55025256510450085d0c557612255b44424f1d7f7f7a77327b791f37e0b8323c flags: 0 RecentlyUsedSceneGuid-6: - value: 55025256510450085d0c557612255b44424f1d7f7f7a77327b791f37e0b8323c + value: 5155560356000f580e5a542112260c444e4f1b2f287d70352c284d63e3b3606f flags: 0 RecentlyUsedSceneGuid-7: value: 0153500006500f5d55565b7b16720b44434f4e2f7c2925607a7c1e62e1b96560