From 2b9e96d0141ac05393aad3738f3fa9a7df97088e Mon Sep 17 00:00:00 2001 From: MB Date: Sun, 27 Jan 2019 12:19:37 +1100 Subject: [PATCH] Fixed Music breakage --- Assets/Scipts/CharacterMovement.cs | 5 ++++- Assets/Scipts/PlayerControllers/LocalPlayer.cs | 2 +- Assets/Scipts/SoundManager.cs | 10 +++++++--- Assets/WorldAssets.meta | 8 -------- 4 files changed, 12 insertions(+), 13 deletions(-) delete mode 100644 Assets/WorldAssets.meta diff --git a/Assets/Scipts/CharacterMovement.cs b/Assets/Scipts/CharacterMovement.cs index 4b32d56..50710ae 100644 --- a/Assets/Scipts/CharacterMovement.cs +++ b/Assets/Scipts/CharacterMovement.cs @@ -66,7 +66,10 @@ public class CharacterMovement : MonoBehaviour { public void Greet() { - Cheer.Play(); + if (Cheer != null) + { + Cheer.Play(); + } //Trigger animation } } diff --git a/Assets/Scipts/PlayerControllers/LocalPlayer.cs b/Assets/Scipts/PlayerControllers/LocalPlayer.cs index 9370e22..9b7f574 100644 --- a/Assets/Scipts/PlayerControllers/LocalPlayer.cs +++ b/Assets/Scipts/PlayerControllers/LocalPlayer.cs @@ -52,7 +52,7 @@ public class LocalPlayer : Player { } Animator.SetFloat("WalkSpeed", animWalkSpeed); - if (WalkingSounds.isPlaying != true) + if ( WalkingSounds != null && WalkingSounds.isPlaying != true) { WalkingSounds.Play(); } diff --git a/Assets/Scipts/SoundManager.cs b/Assets/Scipts/SoundManager.cs index 3bf9509..9a0fbe8 100644 --- a/Assets/Scipts/SoundManager.cs +++ b/Assets/Scipts/SoundManager.cs @@ -12,9 +12,13 @@ public class SoundManager : MonoBehaviour { AudioSource curMusic; public void Start() { - Startmusic.Play(); - StartCoroutine(ChangeMusic(loopMusic, Startmusic.clip.length)); - StartCoroutine(ChangeMusic(loopMusic, gameLength - 10.0f)); + if (Startmusic != null) + { + curMusic = Startmusic; + Startmusic.Play(); + StartCoroutine(ChangeMusic(loopMusic, Startmusic.clip.length)); + StartCoroutine(ChangeMusic(loopMusic, gameLength - 10.0f)); + } } private void Update() diff --git a/Assets/WorldAssets.meta b/Assets/WorldAssets.meta deleted file mode 100644 index b49880d..0000000 --- a/Assets/WorldAssets.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 7da0e8d0a6415f944aa43dff57b38ae3 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: