浏览代码

Fixes on the AudioManager, music in the Main Menu

/UI
Ciro Continisio 4 年前
当前提交
f6f1ad38
共有 15 个文件被更改,包括 191 次插入27 次删除
  1. 50
      UOP1_Project/Assets/AddressableAssetsData/AssetGroups/MusicTracks.asset
  2. 14
      UOP1_Project/Assets/AddressableAssetsData/AssetGroups/SFX.asset
  3. 8
      UOP1_Project/Assets/AddressableAssetsData/AssetGroups/Schemas/MusicTracks_BundledAssetGroupSchema.asset
  4. 4
      UOP1_Project/Assets/AddressableAssetsData/AssetGroups/Schemas/MusicTracks_ContentUpdateGroupSchema.asset
  5. 85
      UOP1_Project/Assets/Scenes/Menus/MainMenu.unity
  6. 2
      UOP1_Project/Assets/ScriptableObjects/SceneData/Menus/MainMenu.asset
  7. 7
      UOP1_Project/Assets/Scripts/Audio/AudioManager.cs
  8. 2
      UOP1_Project/Assets/Scripts/Audio/MusicPlayer.cs
  9. 1
      UOP1_Project/Assets/Scripts/Audio/SoundEmitters/SoundEmitter.cs
  10. 1
      UOP1_Project/Assets/Scripts/SceneManagement/ScriptableObjects/GameSceneSO.cs
  11. 1
      UOP1_Project/Assets/Scripts/SceneManagement/ScriptableObjects/LocationSO.cs
  12. 8
      UOP1_Project/Assets/Scenes/Skybox/ClearSky.meta
  13. 19
      UOP1_Project/Assets/ScriptableObjects/Audio/AudioCues/Music/Music_MainTheme.asset
  14. 8
      UOP1_Project/Assets/ScriptableObjects/Audio/AudioCues/Music/Music_MainTheme.asset.meta
  15. 8
      UOP1_Project/Assets/StreamingAssets.meta

50
UOP1_Project/Assets/AddressableAssetsData/AssetGroups/MusicTracks.asset


m_Script: {fileID: 11500000, guid: bbb281ee3bf0b054c82ac2347e9e782c, type: 3}
m_Name: MusicTracks
m_EditorClassIdentifier:
m_GroupName: Packed Assets
m_GroupName: MusicTracks
m_SerializeEntries: []
m_SerializeEntries:
- m_GUID: 0d3b647e3c636ab40a6d9b48d8ffab35
m_Address: Assets/Audio/Music/Music_Beach.wav
m_ReadOnly: 0
m_SerializedLabels: []
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: f55746203c03f2141a9e1a1649072238
m_Address: Assets/Audio/Music/Music_Forest.wav
m_ReadOnly: 0
m_SerializedLabels: []
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: 9871c84304b51b24c9c545454c791b2f
m_Address: Assets/Audio/Music/Music_Glade.wav
m_ReadOnly: 0
m_SerializedLabels: []
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: 1a61bf74a2f341b498082f54f67188b5
m_Address: Assets/Audio/Music/Music_MainTheme.wav
m_ReadOnly: 0
m_SerializedLabels: []
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: 18249a96d1decd241a4e0fc9bb78ebb6
m_Address: Assets/Audio/Music/Music_Path.wav
m_ReadOnly: 0
m_SerializedLabels: []
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: 72ef6eda0caaa744a819f1c0bcfce397
m_Address: Assets/Audio/Music/Music_PauseMenu.wav
m_ReadOnly: 0
m_SerializedLabels: []
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: 848739acdaf728b45a57a87160f9021e
m_Address: Assets/Audio/Music/Music_Town.wav
m_ReadOnly: 0
m_SerializedLabels: []
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
m_Schemas: []
m_Schemas:
- {fileID: 11400000, guid: 8463d1b8bad77e342b617bcedc02ec3a, type: 2}
- {fileID: 11400000, guid: a19f7b2b258a48f49aa5e6ab3a77c765, type: 2}

14
UOP1_Project/Assets/AddressableAssetsData/AssetGroups/SFX.asset


m_Script: {fileID: 11500000, guid: bbb281ee3bf0b054c82ac2347e9e782c, type: 3}
m_Name: SFX
m_EditorClassIdentifier:
m_GroupName: Packed Assets
m_GroupName: SFX
m_SerializeEntries: []
m_SerializeEntries:
- m_GUID: 283a4aea3a1670c4ebf8fa5901d18c08
m_Address: Assets/Audio/SFX
m_ReadOnly: 0
m_SerializedLabels: []
m_MainAsset: {fileID: 102900000, guid: 283a4aea3a1670c4ebf8fa5901d18c08, type: 3}
m_TargetAsset: {fileID: 102900000, guid: 283a4aea3a1670c4ebf8fa5901d18c08, type: 3}
m_Schemas: []
m_Schemas:
- {fileID: 11400000, guid: 55465dd6c93d83d439579d4dfa80c947, type: 2}
- {fileID: 11400000, guid: c3328767eca3b18418a23e420b4e3b86, type: 2}

8
UOP1_Project/Assets/AddressableAssetsData/AssetGroups/Schemas/MusicTracks_BundledAssetGroupSchema.asset


m_Script: {fileID: 11500000, guid: e5d17a21594effb4e9591490b009e7aa, type: 3}
m_Name: MusicTracks_BundledAssetGroupSchema
m_EditorClassIdentifier:
m_Group: {fileID: 0}
m_Group: {fileID: 11400000, guid: c6089159bfe469d46ad3b0e68fe4aa09, type: 2}
m_Compression: 1
m_IncludeAddressInCatalog: 1
m_IncludeGUIDInCatalog: 1

m_RedirectLimit: -1
m_RetryCount: 0
m_BuildPath:
m_Id:
m_Id: 5002d2ecf2c3647f8b6e3a264a6b45f8
m_Id:
m_BundleMode: 0
m_Id: 343a2af8396fc47cb9e730bf77e141f0
m_BundleMode: 1
m_AssetBundleProviderType:
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider

4
UOP1_Project/Assets/AddressableAssetsData/AssetGroups/Schemas/MusicTracks_ContentUpdateGroupSchema.asset


m_Script: {fileID: 11500000, guid: 5834b5087d578d24c926ce20cd31e6d6, type: 3}
m_Name: MusicTracks_ContentUpdateGroupSchema
m_EditorClassIdentifier:
m_Group: {fileID: 0}
m_StaticContent: 0
m_Group: {fileID: 11400000, guid: c6089159bfe469d46ad3b0e68fe4aa09, type: 2}
m_StaticContent: 1

85
UOP1_Project/Assets/Scenes/Menus/MainMenu.unity


m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1
m_UseShadowmask: 0
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2

debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1001 &115741521
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 7961433267914593990, guid: 0b664a194840b8947ba233200964f991,
type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7961433267914593990, guid: 0b664a194840b8947ba233200964f991,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7961433267914593990, guid: 0b664a194840b8947ba233200964f991,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7961433267914593990, guid: 0b664a194840b8947ba233200964f991,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7961433267914593990, guid: 0b664a194840b8947ba233200964f991,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7961433267914593990, guid: 0b664a194840b8947ba233200964f991,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7961433267914593990, guid: 0b664a194840b8947ba233200964f991,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7961433267914593990, guid: 0b664a194840b8947ba233200964f991,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7961433267914593990, guid: 0b664a194840b8947ba233200964f991,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7961433267914593990, guid: 0b664a194840b8947ba233200964f991,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7961433267914593990, guid: 0b664a194840b8947ba233200964f991,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7961433267914593992, guid: 0b664a194840b8947ba233200964f991,
type: 3}
propertyPath: m_Name
value: MusicPlayer
objectReference: {fileID: 0}
- target: {fileID: 7961433267914593993, guid: 0b664a194840b8947ba233200964f991,
type: 3}
propertyPath: _thisSceneSO
value:
objectReference: {fileID: 11400000, guid: 431ff81b74b48fb4d9301fb76ca633dd,
type: 2}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 0b664a194840b8947ba233200964f991, type: 3}
--- !u!1 &403475996
GameObject:
m_ObjectHideFlags: 0

- target: {fileID: 40564194958535909, guid: 54d1f8b93400ea64d97c276fab375df3,
type: 3}
propertyPath: m_RootOrder
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 40564194958535909, guid: 54d1f8b93400ea64d97c276fab375df3,
type: 3}

m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!81 &1419319622
AudioListener:

m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1806157292
GameObject:

- {fileID: 684748717}
- {fileID: 821853655}
m_Father: {fileID: 0}
m_RootOrder: 1
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}

2
UOP1_Project/Assets/ScriptableObjects/SceneData/Menus/MainMenu.asset


m_Script: {fileID: 11500000, guid: 3546e1f9ebb6f054fb677b86f543542b, type: 3}
m_Name: MainMenu
m_EditorClassIdentifier:
_guid: 431ff81b74b48fb4d9301fb76ca633dd
description: Main/title menu, the only menu that exists as a standalone scene
sceneType: 1
sceneReference:

musicTrack: {fileID: 11400000, guid: 755065c424b9ce346977ffa54ae3c9c1, type: 2}

7
UOP1_Project/Assets/Scripts/Audio/AudioManager.cs


_musicSoundEmitter = _pool.Request();
_musicSoundEmitter.FadeMusicIn(audioCue.GetClips()[0], audioConfiguration, 1f, startTime);
_musicSoundEmitter.OnSoundFinishedPlaying += StopMusicEmitter;
return AudioCueKey.Invalid; //No need to return a valid key for music
}

//TODO: is the above enough?
//_soundEmitterVault.Remove(audioCueKey); is never called if StopAndClean is called after a Finish event
//How is the key removed from the vault?
}
private void StopMusicEmitter(SoundEmitter soundEmitter)
{
soundEmitter.OnSoundFinishedPlaying -= StopMusicEmitter;
_pool.Return(soundEmitter);
}
}

2
UOP1_Project/Assets/Scripts/Audio/MusicPlayer.cs


{
[SerializeField] private VoidEventChannelSO _onSceneReady = default;
[SerializeField] private AudioCueEventChannelSO _playMusicOn = default;
[SerializeField] private LocationSO _thisSceneSO = default;
[SerializeField] private GameSceneSO _thisSceneSO = default;
[SerializeField] private AudioConfigurationSO _audioConfig = default;
private void OnEnable()

1
UOP1_Project/Assets/Scripts/Audio/SoundEmitters/SoundEmitter.cs


settings.ApplyTo(_audioSource);
_audioSource.transform.position = position;
_audioSource.loop = hasToLoop;
_audioSource.time = 0f; //Reset in case this AudioSource is being reused for a short SFX after being used for a long music track
_audioSource.Play();
if (!hasToLoop)

1
UOP1_Project/Assets/Scripts/SceneManagement/ScriptableObjects/GameSceneSO.cs


{
public GameSceneType sceneType;
public AssetReference sceneReference; //Used at runtime to load the scene from the right AssetBundle
public AudioCueSO musicTrack;
/// <summary>
/// Used by the SceneSelector tool to discern what type of scene it needs to load

1
UOP1_Project/Assets/Scripts/SceneManagement/ScriptableObjects/LocationSO.cs


public class LocationSO : GameSceneSO
{
public LocalizedString locationName;
public AudioCueSO musicTrack;
}

8
UOP1_Project/Assets/Scenes/Skybox/ClearSky.meta


fileFormatVersion: 2
guid: 6a7ead41d5a038a42b2d15a980df4e00
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

19
UOP1_Project/Assets/ScriptableObjects/Audio/AudioCues/Music/Music_MainTheme.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 08e854ccd8588da4694c3ae040c10c5e, type: 3}
m_Name: Music_MainTheme
m_EditorClassIdentifier:
looping: 1
_audioClipGroups:
- sequenceMode: 2
audioClips:
- {fileID: 8300000, guid: 1a61bf74a2f341b498082f54f67188b5, type: 3}

8
UOP1_Project/Assets/ScriptableObjects/Audio/AudioCues/Music/Music_MainTheme.asset.meta


fileFormatVersion: 2
guid: 755065c424b9ce346977ffa54ae3c9c1
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

8
UOP1_Project/Assets/StreamingAssets.meta


fileFormatVersion: 2
guid: 31fc358886e31a249a1423f673f95603
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存