From 28e03f239536007312356288cae0a82ccf2ea630 Mon Sep 17 00:00:00 2001 From: Fangh Date: Sun, 28 Jan 2024 15:42:54 +0100 Subject: [PATCH] add audiomanager --- Assets/{Audio SFX.meta => Audios.meta} | 0 Assets/Audios/Mixer.mixer | 138 +++++++ Assets/Audios/Mixer.mixer.meta | 8 + Assets/{ => Audios}/Music.meta | 0 .../Music/Music_Ending.mp3} | 0 .../Music/Music_Ending.mp3.meta} | 0 .../Menu.mp3 => Audios/Music/Music_Menu.mp3} | 0 .../Music/Music_Menu.mp3.meta} | 0 .../Music/Music_Taking picture.mp3} | 0 .../Music/Music_Taking picture.mp3.meta} | 0 .../Music/Music_Voting session.mp3} | 0 .../Music/Music_Voting session.mp3.meta} | 0 Assets/Audios/SFX.meta | 8 + .../SFX}/Click validate.mp3 | 0 .../SFX}/Click validate.mp3.meta | 0 Assets/{Audio SFX => Audios/SFX}/Decompte.mp3 | 0 .../SFX}/Decompte.mp3.meta | 0 Assets/{Audio SFX => Audios/SFX}/Restart.mp3 | 0 .../SFX}/Restart.mp3.meta | 0 .../{Audio SFX => Audios/SFX}/Selfie mode.mp3 | 0 .../SFX}/Selfie mode.mp3.meta | 0 .../SFX}/camera-flash-sound-effect.mp3 | 0 .../SFX}/camera-flash-sound-effect.mp3.meta | 0 .../SFX}/incorrect-buzzer-sound-147336.mp3 | 0 .../incorrect-buzzer-sound-147336.mp3.meta | 0 Assets/Scenes/ComputerView.unity | 339 ++---------------- Assets/Scripts/AudioManager.cs | 49 +++ Assets/Scripts/AudioManager.cs.meta | 11 + Assets/Scripts/RoomManager.cs | 7 +- 29 files changed, 254 insertions(+), 306 deletions(-) rename Assets/{Audio SFX.meta => Audios.meta} (100%) create mode 100644 Assets/Audios/Mixer.mixer create mode 100644 Assets/Audios/Mixer.mixer.meta rename Assets/{ => Audios}/Music.meta (100%) rename Assets/{Music/Ending.mp3 => Audios/Music/Music_Ending.mp3} (100%) rename Assets/{Music/Ending.mp3.meta => Audios/Music/Music_Ending.mp3.meta} (100%) rename Assets/{Music/Menu.mp3 => Audios/Music/Music_Menu.mp3} (100%) rename Assets/{Music/Menu.mp3.meta => Audios/Music/Music_Menu.mp3.meta} (100%) rename Assets/{Music/Taking picture.mp3 => Audios/Music/Music_Taking picture.mp3} (100%) rename Assets/{Music/Taking picture.mp3.meta => Audios/Music/Music_Taking picture.mp3.meta} (100%) rename Assets/{Music/Voting session.mp3 => Audios/Music/Music_Voting session.mp3} (100%) rename Assets/{Music/Voting session.mp3.meta => Audios/Music/Music_Voting session.mp3.meta} (100%) create mode 100644 Assets/Audios/SFX.meta rename Assets/{Audio SFX => Audios/SFX}/Click validate.mp3 (100%) rename Assets/{Audio SFX => Audios/SFX}/Click validate.mp3.meta (100%) rename Assets/{Audio SFX => Audios/SFX}/Decompte.mp3 (100%) rename Assets/{Audio SFX => Audios/SFX}/Decompte.mp3.meta (100%) rename Assets/{Audio SFX => Audios/SFX}/Restart.mp3 (100%) rename Assets/{Audio SFX => Audios/SFX}/Restart.mp3.meta (100%) rename Assets/{Audio SFX => Audios/SFX}/Selfie mode.mp3 (100%) rename Assets/{Audio SFX => Audios/SFX}/Selfie mode.mp3.meta (100%) rename Assets/{Audio SFX => Audios/SFX}/camera-flash-sound-effect.mp3 (100%) rename Assets/{Audio SFX => Audios/SFX}/camera-flash-sound-effect.mp3.meta (100%) rename Assets/{Audio SFX => Audios/SFX}/incorrect-buzzer-sound-147336.mp3 (100%) rename Assets/{Audio SFX => Audios/SFX}/incorrect-buzzer-sound-147336.mp3.meta (100%) create mode 100644 Assets/Scripts/AudioManager.cs create mode 100644 Assets/Scripts/AudioManager.cs.meta diff --git a/Assets/Audio SFX.meta b/Assets/Audios.meta similarity index 100% rename from Assets/Audio SFX.meta rename to Assets/Audios.meta diff --git a/Assets/Audios/Mixer.mixer b/Assets/Audios/Mixer.mixer new file mode 100644 index 0000000..a272872 --- /dev/null +++ b/Assets/Audios/Mixer.mixer @@ -0,0 +1,138 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!243 &-9193339872731100694 +AudioMixerGroupController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Music + m_AudioMixer: {fileID: 24100000} + m_GroupID: f17cabc87452649a2b18d96000b669b0 + m_Children: [] + m_Volume: 1613f111ba37b4211ab10fd731a08910 + m_Pitch: 6d534022cb299469fb27178e6680f82d + m_Send: 00000000000000000000000000000000 + m_Effects: + - {fileID: 4578690053529407285} + m_UserColorIndex: 0 + m_Mute: 0 + m_Solo: 0 + m_BypassEffects: 0 +--- !u!241 &24100000 +AudioMixerController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Mixer + m_OutputGroup: {fileID: 0} + m_MasterGroup: {fileID: 24300002} + m_Snapshots: + - {fileID: 24500006} + m_StartSnapshot: {fileID: 24500006} + m_SuspendThreshold: -80 + m_EnableSuspend: 1 + m_UpdateMode: 0 + m_ExposedParameters: [] + m_AudioMixerGroupViews: + - guids: + - 501d2c8a51be649b898772eac7a44794 + - a742f5087766d478eb021c8040417802 + - f17cabc87452649a2b18d96000b669b0 + name: View + m_CurrentViewIndex: 0 + m_TargetSnapshot: {fileID: 24500006} +--- !u!243 &24300002 +AudioMixerGroupController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Master + m_AudioMixer: {fileID: 24100000} + m_GroupID: 501d2c8a51be649b898772eac7a44794 + m_Children: + - {fileID: -9193339872731100694} + - {fileID: 5041602002061892305} + m_Volume: 526d9581d6f68479082360ed52a3573d + m_Pitch: ed81dc3454ff54047857730f0dff0d4c + m_Send: 00000000000000000000000000000000 + m_Effects: + - {fileID: 24400004} + m_UserColorIndex: 0 + m_Mute: 0 + m_Solo: 0 + m_BypassEffects: 0 +--- !u!244 &24400004 +AudioMixerEffectController: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_EffectID: f7295dc1bc0fc43cbbdd7b8e97df58a2 + m_EffectName: Attenuation + m_MixLevel: 71d20df30fbaf4f2f8bf27e4cf1c7510 + m_Parameters: [] + m_SendTarget: {fileID: 0} + m_EnableWetMix: 0 + m_Bypass: 0 +--- !u!245 &24500006 +AudioMixerSnapshotController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Snapshot + m_AudioMixer: {fileID: 24100000} + m_SnapshotID: c416757bd7a954c1ba54bd6ca634b0f1 + m_FloatValues: {} + m_TransitionOverrides: {} +--- !u!244 &4578690053529407285 +AudioMixerEffectController: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_EffectID: d1ce4088c24dc46ae864980632dd2680 + m_EffectName: Attenuation + m_MixLevel: 4e486cd7e6e884cab95d5e8270b2af8e + m_Parameters: [] + m_SendTarget: {fileID: 0} + m_EnableWetMix: 0 + m_Bypass: 0 +--- !u!243 &5041602002061892305 +AudioMixerGroupController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: SFX + m_AudioMixer: {fileID: 24100000} + m_GroupID: a742f5087766d478eb021c8040417802 + m_Children: [] + m_Volume: 80e52b4e450ba4077a8d0f1ffe44291b + m_Pitch: 578819f90fb094b109895b05b4070e2a + m_Send: 00000000000000000000000000000000 + m_Effects: + - {fileID: 5698726703439763546} + m_UserColorIndex: 0 + m_Mute: 0 + m_Solo: 0 + m_BypassEffects: 0 +--- !u!244 &5698726703439763546 +AudioMixerEffectController: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_EffectID: a5631bd4d7d27476297f2abba51534fe + m_EffectName: Attenuation + m_MixLevel: 0aca4688c7b884252a81953c0de41d78 + m_Parameters: [] + m_SendTarget: {fileID: 0} + m_EnableWetMix: 0 + m_Bypass: 0 diff --git a/Assets/Audios/Mixer.mixer.meta b/Assets/Audios/Mixer.mixer.meta new file mode 100644 index 0000000..4c1679e --- /dev/null +++ b/Assets/Audios/Mixer.mixer.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 23695c8b913f2468f8e11226c7661601 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 24100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Music.meta b/Assets/Audios/Music.meta similarity index 100% rename from Assets/Music.meta rename to Assets/Audios/Music.meta diff --git a/Assets/Music/Ending.mp3 b/Assets/Audios/Music/Music_Ending.mp3 similarity index 100% rename from Assets/Music/Ending.mp3 rename to Assets/Audios/Music/Music_Ending.mp3 diff --git a/Assets/Music/Ending.mp3.meta b/Assets/Audios/Music/Music_Ending.mp3.meta similarity index 100% rename from Assets/Music/Ending.mp3.meta rename to Assets/Audios/Music/Music_Ending.mp3.meta diff --git a/Assets/Music/Menu.mp3 b/Assets/Audios/Music/Music_Menu.mp3 similarity index 100% rename from Assets/Music/Menu.mp3 rename to Assets/Audios/Music/Music_Menu.mp3 diff --git a/Assets/Music/Menu.mp3.meta b/Assets/Audios/Music/Music_Menu.mp3.meta similarity index 100% rename from Assets/Music/Menu.mp3.meta rename to Assets/Audios/Music/Music_Menu.mp3.meta diff --git a/Assets/Music/Taking picture.mp3 b/Assets/Audios/Music/Music_Taking picture.mp3 similarity index 100% rename from Assets/Music/Taking picture.mp3 rename to Assets/Audios/Music/Music_Taking picture.mp3 diff --git a/Assets/Music/Taking picture.mp3.meta b/Assets/Audios/Music/Music_Taking picture.mp3.meta similarity index 100% rename from Assets/Music/Taking picture.mp3.meta rename to Assets/Audios/Music/Music_Taking picture.mp3.meta diff --git a/Assets/Music/Voting session.mp3 b/Assets/Audios/Music/Music_Voting session.mp3 similarity index 100% rename from Assets/Music/Voting session.mp3 rename to Assets/Audios/Music/Music_Voting session.mp3 diff --git a/Assets/Music/Voting session.mp3.meta b/Assets/Audios/Music/Music_Voting session.mp3.meta similarity index 100% rename from Assets/Music/Voting session.mp3.meta rename to Assets/Audios/Music/Music_Voting session.mp3.meta diff --git a/Assets/Audios/SFX.meta b/Assets/Audios/SFX.meta new file mode 100644 index 0000000..5ff574d --- /dev/null +++ b/Assets/Audios/SFX.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d46d224afa2204875ad747a7d01a4cb2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Audio SFX/Click validate.mp3 b/Assets/Audios/SFX/Click validate.mp3 similarity index 100% rename from Assets/Audio SFX/Click validate.mp3 rename to Assets/Audios/SFX/Click validate.mp3 diff --git a/Assets/Audio SFX/Click validate.mp3.meta b/Assets/Audios/SFX/Click validate.mp3.meta similarity index 100% rename from Assets/Audio SFX/Click validate.mp3.meta rename to Assets/Audios/SFX/Click validate.mp3.meta diff --git a/Assets/Audio SFX/Decompte.mp3 b/Assets/Audios/SFX/Decompte.mp3 similarity index 100% rename from Assets/Audio SFX/Decompte.mp3 rename to Assets/Audios/SFX/Decompte.mp3 diff --git a/Assets/Audio SFX/Decompte.mp3.meta b/Assets/Audios/SFX/Decompte.mp3.meta similarity index 100% rename from Assets/Audio SFX/Decompte.mp3.meta rename to Assets/Audios/SFX/Decompte.mp3.meta diff --git a/Assets/Audio SFX/Restart.mp3 b/Assets/Audios/SFX/Restart.mp3 similarity index 100% rename from Assets/Audio SFX/Restart.mp3 rename to Assets/Audios/SFX/Restart.mp3 diff --git a/Assets/Audio SFX/Restart.mp3.meta b/Assets/Audios/SFX/Restart.mp3.meta similarity index 100% rename from Assets/Audio SFX/Restart.mp3.meta rename to Assets/Audios/SFX/Restart.mp3.meta diff --git a/Assets/Audio SFX/Selfie mode.mp3 b/Assets/Audios/SFX/Selfie mode.mp3 similarity index 100% rename from Assets/Audio SFX/Selfie mode.mp3 rename to Assets/Audios/SFX/Selfie mode.mp3 diff --git a/Assets/Audio SFX/Selfie mode.mp3.meta b/Assets/Audios/SFX/Selfie mode.mp3.meta similarity index 100% rename from Assets/Audio SFX/Selfie mode.mp3.meta rename to Assets/Audios/SFX/Selfie mode.mp3.meta diff --git a/Assets/Audio SFX/camera-flash-sound-effect.mp3 b/Assets/Audios/SFX/camera-flash-sound-effect.mp3 similarity index 100% rename from Assets/Audio SFX/camera-flash-sound-effect.mp3 rename to Assets/Audios/SFX/camera-flash-sound-effect.mp3 diff --git a/Assets/Audio SFX/camera-flash-sound-effect.mp3.meta b/Assets/Audios/SFX/camera-flash-sound-effect.mp3.meta similarity index 100% rename from Assets/Audio SFX/camera-flash-sound-effect.mp3.meta rename to Assets/Audios/SFX/camera-flash-sound-effect.mp3.meta diff --git a/Assets/Audio SFX/incorrect-buzzer-sound-147336.mp3 b/Assets/Audios/SFX/incorrect-buzzer-sound-147336.mp3 similarity index 100% rename from Assets/Audio SFX/incorrect-buzzer-sound-147336.mp3 rename to Assets/Audios/SFX/incorrect-buzzer-sound-147336.mp3 diff --git a/Assets/Audio SFX/incorrect-buzzer-sound-147336.mp3.meta b/Assets/Audios/SFX/incorrect-buzzer-sound-147336.mp3.meta similarity index 100% rename from Assets/Audio SFX/incorrect-buzzer-sound-147336.mp3.meta rename to Assets/Audios/SFX/incorrect-buzzer-sound-147336.mp3.meta diff --git a/Assets/Scenes/ComputerView.unity b/Assets/Scenes/ComputerView.unity index f56c703..8f8116e 100644 --- a/Assets/Scenes/ComputerView.unity +++ b/Assets/Scenes/ComputerView.unity @@ -946,7 +946,7 @@ MonoBehaviour: m_text: 1234567890123456 m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 72af27804d5aa49408430b4b2500f877, type: 2} - m_sharedMaterial: {fileID: 2100000, guid: fa964d4661e244562b12b69df5792611, type: 2} + m_sharedMaterial: {fileID: 8890805173838430465, guid: 72af27804d5aa49408430b4b2500f877, type: 2} m_fontSharedMaterials: [] m_fontMaterial: {fileID: 0} m_fontMaterials: [] @@ -1703,7 +1703,7 @@ MonoBehaviour: m_text: 1234567890123456 m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 72af27804d5aa49408430b4b2500f877, type: 2} - m_sharedMaterial: {fileID: 2100000, guid: fa964d4661e244562b12b69df5792611, type: 2} + m_sharedMaterial: {fileID: 8890805173838430465, guid: 72af27804d5aa49408430b4b2500f877, type: 2} m_fontSharedMaterials: [] m_fontMaterial: {fileID: 0} m_fontMaterials: [] @@ -2200,7 +2200,7 @@ MonoBehaviour: m_text: 1234567890123456 m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 72af27804d5aa49408430b4b2500f877, type: 2} - m_sharedMaterial: {fileID: 2100000, guid: fa964d4661e244562b12b69df5792611, type: 2} + m_sharedMaterial: {fileID: 8890805173838430465, guid: 72af27804d5aa49408430b4b2500f877, type: 2} m_fontSharedMaterials: [] m_fontMaterial: {fileID: 0} m_fontMaterials: [] @@ -4009,7 +4009,7 @@ MonoBehaviour: m_text: 1234567890123456 m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 72af27804d5aa49408430b4b2500f877, type: 2} - m_sharedMaterial: {fileID: 2100000, guid: fa964d4661e244562b12b69df5792611, type: 2} + m_sharedMaterial: {fileID: 8890805173838430465, guid: 72af27804d5aa49408430b4b2500f877, type: 2} m_fontSharedMaterials: [] m_fontMaterial: {fileID: 0} m_fontMaterials: [] @@ -4479,7 +4479,7 @@ MonoBehaviour: m_text: 1234567890123456 m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 72af27804d5aa49408430b4b2500f877, type: 2} - m_sharedMaterial: {fileID: 2100000, guid: fa964d4661e244562b12b69df5792611, type: 2} + m_sharedMaterial: {fileID: 8890805173838430465, guid: 72af27804d5aa49408430b4b2500f877, type: 2} m_fontSharedMaterials: [] m_fontMaterial: {fileID: 0} m_fontMaterials: [] @@ -4882,7 +4882,6 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1117928115} - - component: {fileID: 1117928116} m_Layer: 5 m_Name: WaitingForPlayersPage m_TagString: Untagged @@ -4919,102 +4918,6 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} ---- !u!82 &1117928116 -AudioSource: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1117928114} - m_Enabled: 1 - serializedVersion: 4 - OutputAudioMixerGroup: {fileID: 0} - m_audioClip: {fileID: 8300000, guid: 7ac3efdb5c840704aafbf19188b3e61e, 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 &1141337195 GameObject: m_ObjectHideFlags: 0 @@ -5738,6 +5641,7 @@ GameObject: m_Component: - component: {fileID: 1277491650} - component: {fileID: 1277491651} + - component: {fileID: 1277491652} m_Layer: 0 m_Name: MusicManager m_TagString: Untagged @@ -5769,8 +5673,8 @@ AudioSource: m_GameObject: {fileID: 1277491649} m_Enabled: 1 serializedVersion: 4 - OutputAudioMixerGroup: {fileID: 0} - m_audioClip: {fileID: 0} + OutputAudioMixerGroup: {fileID: -9193339872731100694, guid: 23695c8b913f2468f8e11226c7661601, type: 2} + m_audioClip: {fileID: 8300000, guid: 7ac3efdb5c840704aafbf19188b3e61e, type: 3} m_PlayOnAwake: 1 m_Volume: 1 m_Pitch: 1 @@ -5856,6 +5760,27 @@ AudioSource: m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 +--- !u!114 &1277491652 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1277491649} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ccc6142918f2946509e0c02fbe0df427, type: 3} + m_Name: + m_EditorClassIdentifier: + musics: + - title: 0 + clip: {fileID: 8300000, guid: 7ac3efdb5c840704aafbf19188b3e61e, type: 3} + - title: 1 + clip: {fileID: 8300000, guid: 0e86c0433979a2d4c884b368808d3cdf, type: 3} + - title: 2 + clip: {fileID: 8300000, guid: d782d7e00ee5a0d40a3c005d87c15b3a, type: 3} + - title: 3 + clip: {fileID: 8300000, guid: e1135788bf319bd42b6ca512976f9028, type: 3} --- !u!1 &1318111281 GameObject: m_ObjectHideFlags: 0 @@ -6476,7 +6401,6 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1451481718} - - component: {fileID: 1451481719} m_Layer: 5 m_Name: ScorePictureState m_TagString: Untagged @@ -6507,102 +6431,6 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} ---- !u!82 &1451481719 -AudioSource: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1451481717} - m_Enabled: 1 - serializedVersion: 4 - OutputAudioMixerGroup: {fileID: 0} - m_audioClip: {fileID: 8300000, guid: e1135788bf319bd42b6ca512976f9028, 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 &1452182575 GameObject: m_ObjectHideFlags: 0 @@ -6663,7 +6491,7 @@ MonoBehaviour: m_text: 1234567890123456 m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 72af27804d5aa49408430b4b2500f877, type: 2} - m_sharedMaterial: {fileID: 2100000, guid: fa964d4661e244562b12b69df5792611, type: 2} + m_sharedMaterial: {fileID: 8890805173838430465, guid: 72af27804d5aa49408430b4b2500f877, type: 2} m_fontSharedMaterials: [] m_fontMaterial: {fileID: 0} m_fontMaterials: [] @@ -6841,7 +6669,7 @@ MonoBehaviour: m_text: funnny text m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 72af27804d5aa49408430b4b2500f877, type: 2} - m_sharedMaterial: {fileID: 2100000, guid: fa964d4661e244562b12b69df5792611, type: 2} + m_sharedMaterial: {fileID: 8890805173838430465, guid: 72af27804d5aa49408430b4b2500f877, type: 2} m_fontSharedMaterials: [] m_fontMaterial: {fileID: 0} m_fontMaterials: [] @@ -7335,7 +7163,7 @@ MonoBehaviour: m_text: 'Room Code :' m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 72af27804d5aa49408430b4b2500f877, type: 2} - m_sharedMaterial: {fileID: 2100000, guid: fa964d4661e244562b12b69df5792611, type: 2} + m_sharedMaterial: {fileID: 8890805173838430465, guid: 72af27804d5aa49408430b4b2500f877, type: 2} m_fontSharedMaterials: [] m_fontMaterial: {fileID: 0} m_fontMaterials: [] @@ -7552,7 +7380,6 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1730465903} - - component: {fileID: 1730465904} m_Layer: 5 m_Name: WaitingForPropositionPage m_TagString: Untagged @@ -7584,102 +7411,6 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} ---- !u!82 &1730465904 -AudioSource: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1730465902} - m_Enabled: 1 - serializedVersion: 4 - OutputAudioMixerGroup: {fileID: 0} - m_audioClip: {fileID: 8300000, guid: 0e86c0433979a2d4c884b368808d3cdf, 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 &1730898850 GameObject: m_ObjectHideFlags: 0 @@ -8008,7 +7739,7 @@ MonoBehaviour: m_text: 1234567890123456 m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 72af27804d5aa49408430b4b2500f877, type: 2} - m_sharedMaterial: {fileID: 2100000, guid: fa964d4661e244562b12b69df5792611, type: 2} + m_sharedMaterial: {fileID: 8890805173838430465, guid: 72af27804d5aa49408430b4b2500f877, type: 2} m_fontSharedMaterials: [] m_fontMaterial: {fileID: 0} m_fontMaterials: [] @@ -9537,7 +9268,7 @@ AudioSource: m_GameObject: {fileID: 1937957481} m_Enabled: 1 serializedVersion: 4 - OutputAudioMixerGroup: {fileID: 0} + OutputAudioMixerGroup: {fileID: 5041602002061892305, guid: 23695c8b913f2468f8e11226c7661601, type: 2} m_audioClip: {fileID: 0} m_PlayOnAwake: 1 m_Volume: 1 @@ -10380,7 +10111,7 @@ MonoBehaviour: m_text: 1234567890123456 m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 72af27804d5aa49408430b4b2500f877, type: 2} - m_sharedMaterial: {fileID: 2100000, guid: fa964d4661e244562b12b69df5792611, type: 2} + m_sharedMaterial: {fileID: 8890805173838430465, guid: 72af27804d5aa49408430b4b2500f877, type: 2} m_fontSharedMaterials: [] m_fontMaterial: {fileID: 0} m_fontMaterials: [] diff --git a/Assets/Scripts/AudioManager.cs b/Assets/Scripts/AudioManager.cs new file mode 100644 index 0000000..b15e501 --- /dev/null +++ b/Assets/Scripts/AudioManager.cs @@ -0,0 +1,49 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class AudioManager : MonoBehaviour +{ + public AudioSource musicSource; + public AudioSource sfxSource; + public List musics = new List(); + + public static AudioManager Instance; + + + private void Awake() + { + Instance = this; + } + + public void ChangeMusic(MusicTitle _title) + { + musicSource.clip = musics.Find(x => x.title == _title).clip; + musicSource.Play(); + } + + public void StopMusic() + { + musicSource.Stop(); + } + + public void PlaySFX(AudioClip _clip) + { + sfxSource.PlayOneShot(_clip); + } +} + +[System.Serializable] +public class MusicByTitle +{ + public MusicTitle title; + public AudioClip clip; +} + +public enum MusicTitle +{ + Menu, + TakingPicture, + VotingSession, + Ending +} diff --git a/Assets/Scripts/AudioManager.cs.meta b/Assets/Scripts/AudioManager.cs.meta new file mode 100644 index 0000000..c2e739d --- /dev/null +++ b/Assets/Scripts/AudioManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ccc6142918f2946509e0c02fbe0df427 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/RoomManager.cs b/Assets/Scripts/RoomManager.cs index 42cac40..807d181 100644 --- a/Assets/Scripts/RoomManager.cs +++ b/Assets/Scripts/RoomManager.cs @@ -383,17 +383,20 @@ private void OnNewGameStateStarted() waitingForPlayersPage.SetActive(false); explanationPage.SetActive(true); endOfExplanationDate = DateTime.Now.AddSeconds(explanationTime); - AudioSource.PlayClipAtPoint(counterSFX, Vector3.zero); + AudioManager.Instance.PlaySFX(counterSFX); + AudioManager.Instance.StopMusic(); //generate all the questions during the explanation GeneratePrompts(); break; case (int)GameState.MakeProposition: Debug.Log("New State : MakeProposition"); + AudioManager.Instance.ChangeMusic(MusicTitle.TakingPicture); HostHasStartedGame(); break; case (int)GameState.MakeVote: + AudioManager.Instance.ChangeMusic(MusicTitle.VotingSession); votingPage.ShowVotingPage( realtimeDB.Child("rooms").Child(myRoom.code) , myRoom.players @@ -438,7 +441,7 @@ private void CheckPlayersPropositions() /// private void UpdateConnectedPlayerList(List _players) { - AudioSource.PlayClipAtPoint(playerJoinSFX, Vector3.zero); + AudioManager.Instance.PlaySFX(playerJoinSFX); ResetAllPlayerLabels(); Debug.Log($"players count = {_players.Count}");