Merge branch 'develop' into hotfix/Can't-Learn-and-Upgrade-Skill
# Conflicts: # Assets/AddressableAssetsData/AddressableAssetGroupSortSettings.asset # Assets/AddressableAssetsData/AddressableAssetSettings.asset # Assets/AddressableAssetsData/AssetGroups/Schemas/music_BundledAssetGroupSchema.asset # Assets/AddressableAssetsData/AssetGroups/Schemas/music_BundledAssetGroupSchema.asset.meta # Assets/AddressableAssetsData/AssetGroups/Schemas/music_ContentUpdateGroupSchema.asset # Assets/AddressableAssetsData/AssetGroups/Schemas/music_ContentUpdateGroupSchema.asset.meta # Assets/AddressableAssetsData/AssetGroups/music.asset # Assets/AddressableAssetsData/AssetGroups/music.asset.meta
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1419f6cd03e824cf3b17ba8ef9ee80ef
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: beeabaddc14c14f07b9793aefc62f9fa
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ac105eb0ccc374f10b4fea04b01f3d47
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6221f47222ee14f87b8b8ccdfd1ba0c7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,23 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 42623de26b41d48319c3c98734c657bb
|
||||
AudioImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 8
|
||||
defaultSettings:
|
||||
serializedVersion: 2
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
preloadAudioData: 0
|
||||
platformSettingOverrides: {}
|
||||
forceToMono: 0
|
||||
normalize: 1
|
||||
loadInBackground: 0
|
||||
ambisonic: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: df98a3fd090e44f458af27c63a65fd3c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,23 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e5c504ce180264f2c94e1c18c98495e0
|
||||
AudioImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 8
|
||||
defaultSettings:
|
||||
serializedVersion: 2
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
preloadAudioData: 0
|
||||
platformSettingOverrides: {}
|
||||
forceToMono: 0
|
||||
normalize: 1
|
||||
loadInBackground: 0
|
||||
ambisonic: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0a80035676350bb45b34945e65135af3
|
||||
guid: 1419f6cd03e824cf3b17ba8ef9ee80ef
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace BrewMonster.Scripts
|
||||
{
|
||||
public class TemporaryBackgroundMusic : MonoBehaviour
|
||||
{
|
||||
public string backgroundMusicPath;
|
||||
public string ambientSoundPath;
|
||||
|
||||
public AudioSource backgroundMusicSource;
|
||||
public AudioSource ambientSoundSource;
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
// get the HostPlayer
|
||||
SetupAudioSources().Forget();
|
||||
}
|
||||
|
||||
private async UniTask SetupAudioSources()
|
||||
{
|
||||
// get the HostPlayer
|
||||
var hostPlayer = CECGameRun.Instance.GetHostPlayer();
|
||||
|
||||
while (hostPlayer == null)
|
||||
{
|
||||
await UniTask.DelayFrame(1);
|
||||
hostPlayer = CECGameRun.Instance.GetHostPlayer();
|
||||
}
|
||||
|
||||
// attach 2 audio source gameobjects to the host player
|
||||
GameObject backgroundMusicObject = new GameObject("BackgroundMusic");
|
||||
backgroundMusicSource = backgroundMusicObject.AddComponent<AudioSource>();
|
||||
backgroundMusicObject.transform.parent = hostPlayer.transform;
|
||||
backgroundMusicObject.transform.localPosition = Vector3.zero;
|
||||
backgroundMusicObject.transform.localRotation = Quaternion.identity;
|
||||
backgroundMusicObject.transform.localScale = Vector3.one;
|
||||
|
||||
GameObject ambientSoundObject = new GameObject("AmbientSound");
|
||||
ambientSoundSource = ambientSoundObject.AddComponent<AudioSource>();
|
||||
ambientSoundObject.transform.parent = hostPlayer.transform;
|
||||
ambientSoundObject.transform.localPosition = Vector3.zero;
|
||||
ambientSoundObject.transform.localRotation = Quaternion.identity;
|
||||
ambientSoundObject.transform.localScale = Vector3.one;
|
||||
|
||||
await PlayBackgroundMusic();
|
||||
}
|
||||
|
||||
private async UniTask PlayBackgroundMusic()
|
||||
{
|
||||
// use AddressableManager to load the background music and ambient sound
|
||||
var backgroundMusicClip = await AddressableManager.Instance.LoadAudioClipAsync(backgroundMusicPath.ToLower());
|
||||
var ambientSoundClip = await AddressableManager.Instance.LoadAudioClipAsync(ambientSoundPath.ToLower());
|
||||
|
||||
// play the background music and ambient sound
|
||||
backgroundMusicSource.clip = backgroundMusicClip;
|
||||
backgroundMusicSource.loop = true;
|
||||
backgroundMusicSource.Play();
|
||||
ambientSoundSource.clip = ambientSoundClip;
|
||||
ambientSoundSource.loop = true;
|
||||
ambientSoundSource.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7177e3c1538c0477bbcbd3beaacea509
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:80a844f1647a00529b585f34c0ce83c7accc751171d522e33b50787654e98940
|
||||
size 5916998
|
||||
oid sha256:1de882c8c5ed30da035a6646b66fb92328fca652f37ee4e0a885cec817a9f741
|
||||
size 5918457
|
||||
|
||||
Reference in New Issue
Block a user