From 5a3962274c38846cba888ffb7f9edab0ece4d9f4 Mon Sep 17 00:00:00 2001 From: Simon Pinfold Date: Tue, 23 Jun 2015 16:13:07 +1200 Subject: [PATCH 1/2] fix run submission --- .../Maya/Player Model/Hands_To_Unity.fbm.meta | 9 +++++ Assets/Scripts/Goal.cs | 39 ++++++++++++------- 2 files changed, 33 insertions(+), 15 deletions(-) create mode 100644 Assets/Maya/Player Model/Hands_To_Unity.fbm.meta diff --git a/Assets/Maya/Player Model/Hands_To_Unity.fbm.meta b/Assets/Maya/Player Model/Hands_To_Unity.fbm.meta new file mode 100644 index 0000000..37f5338 --- /dev/null +++ b/Assets/Maya/Player Model/Hands_To_Unity.fbm.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 67f7274cc8ca55a4c9c63c2b4a535ff3 +folderAsset: yes +timeCreated: 1431056462 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Goal.cs b/Assets/Scripts/Goal.cs index 759dcb6..cd095e6 100644 --- a/Assets/Scripts/Goal.cs +++ b/Assets/Scripts/Goal.cs @@ -3,8 +3,9 @@ using System; public class Goal : MonoBehaviour -{ - +{ + + public bool submitRuns = false; public string postRunURL = "http://uint8.me:8196/submit_run"; public enum Mode { Normal, Speedrun, Practice }; @@ -127,18 +128,24 @@ void Update() playerController.transform.position = spos; playerController.transform.rotation = srot; - playerController.GetComponent ().StopRecording (); - - string run = playerController.GetComponent ().SaveToString (); - StartCoroutine (PostRun (run)); + playerController.GetComponent ().StopRecording (); + + if (submitRuns) + { + string run = playerController.GetComponent().SaveToString(); + StartCoroutine(PostRun(run)); + } playerController.GetComponent ().ResetRecording (); } if (Input.GetKeyDown (KeyCode.End)) { - playerController.GetComponent ().StopRecording (); - - string run = playerController.GetComponent ().SaveToString (); - StartCoroutine (PostRun (run)); + playerController.GetComponent ().StopRecording (); + + if (submitRuns) + { + string run = playerController.GetComponent().SaveToString(); + StartCoroutine(PostRun(run)); + } playerController.GetComponent ().ResetRecording (); } @@ -171,16 +178,18 @@ void OnCollisionEnter(Collision collision) complete = true; playerController.GetComponent().StopRecording(); - string run = playerController.GetComponent().SaveToString(); - if(playMode== Mode.Speedrun){ player.GetComponent().setEndLevelText("Time "+playerController.GetComponent().getTimeString()); } else player.GetComponent().setEndLevelText("Finish"); - player.GetComponent().EndLevel(); - -// StartCoroutine(PostRun(run)); + player.GetComponent().EndLevel(); + + if (submitRuns) + { + string run = playerController.GetComponent().SaveToString(); + StartCoroutine(PostRun(run)); + } playerController.GetComponent().ResetRecording(); } From fec47a32aa4b27108d95d604b2d83e483db63f67 Mon Sep 17 00:00:00 2001 From: Simon Pinfold Date: Tue, 23 Jun 2015 16:20:19 +1200 Subject: [PATCH 2/2] Fixed bug when the level ended and the audo controller tried to update the volume --- Assets/Scripts/AudioController.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/AudioController.cs b/Assets/Scripts/AudioController.cs index c6ca6c6..75465d7 100644 --- a/Assets/Scripts/AudioController.cs +++ b/Assets/Scripts/AudioController.cs @@ -230,7 +230,8 @@ public void changeVolume(){ float musicVolume = GetComponent().musicVolume/10f; foreach (AudioSource a in audiosourceDic.Keys) a.volume = masterVolume * soundEffectsVolume * audiosourceDic[a]; - musicSource.volume = masterVolume * musicVolume; + if (musicSource) + musicSource.volume = masterVolume * musicVolume; }