From 44e5aa686c161909b344b8164d352d5e3a6f237f Mon Sep 17 00:00:00 2001 From: Joshua Reason Date: Sun, 11 Oct 2015 01:16:47 +1100 Subject: [PATCH] - fixed ground check in play sounds --- .../Character/Character_Animation.controller | Bin 18784 -> 18784 bytes unity_Project/Assets/Scripts/PlayerSounds.cs | 22 +++++++++--------- .../Assets/Scripts/thirdPersonController.cs | 4 +++- unity_Project/Assets/Textures.meta | 9 ------- unity_Project/Assets/_Scenes/MainLevel.unity | Bin 542208 -> 542240 bytes 5 files changed, 14 insertions(+), 21 deletions(-) delete mode 100644 unity_Project/Assets/Textures.meta diff --git a/unity_Project/Assets/Character/Character_Animation.controller b/unity_Project/Assets/Character/Character_Animation.controller index 2f61a4f34ef9fb36c8ba285dbf64b7508a15709d..a1fcb97c200b545af8edd2f698fd820f9543feee 100644 GIT binary patch delta 14 VcmaDbiSfZC#t9OPMjIvFJpnB*1snhX delta 14 VcmaDbiSfZC#t9OP#v3KwJpnB=1swnY diff --git a/unity_Project/Assets/Scripts/PlayerSounds.cs b/unity_Project/Assets/Scripts/PlayerSounds.cs index 9f1a3e0..4658a25 100644 --- a/unity_Project/Assets/Scripts/PlayerSounds.cs +++ b/unity_Project/Assets/Scripts/PlayerSounds.cs @@ -3,9 +3,10 @@ using System.Collections; public class PlayerSounds : MonoBehaviour { - public GameObject PlayerObject; //Player1 or Player2 object. Assign object component in inspector. + public GameObject PlayerObject; + private thirdPersonController playerController;//Player1 or Player2 object. Assign object component in inspector. //private Collider playerCollider; - private bool FootOnSand = true; + public bool FootOnSand = true; private AudioSource source; private float volLowRange = 0.5f; // Volume Low Range @@ -32,6 +33,10 @@ public class PlayerSounds : MonoBehaviour { source = GetComponent (); } + void Start(){ + playerController = PlayerObject.GetComponent (); + } + // FUNCTIONS: Play Sound Effects (SFX) // NOTE: Must add the events to the relevant keyframe within animation clips. @@ -50,17 +55,12 @@ public class PlayerSounds : MonoBehaviour { void CheckGround(){ //playerCollider = PlayerObject.GetComponent; - - RaycastHit FootHit; - - Ray ray = new Ray(transform.position, -Vector3.up); - - if (Physics.Raycast (ray, out FootHit, 1.3f)) { - if (FootHit.transform.tag == "sand") + Debug.Log ("groundCheck"); + RaycastHit FootHit = playerController.hit; + if (FootHit.transform.tag == "sand") FootOnSand = true; - }else{ + else FootOnSand = false; - } } diff --git a/unity_Project/Assets/Scripts/thirdPersonController.cs b/unity_Project/Assets/Scripts/thirdPersonController.cs index 91da8b3..deaee5c 100644 --- a/unity_Project/Assets/Scripts/thirdPersonController.cs +++ b/unity_Project/Assets/Scripts/thirdPersonController.cs @@ -42,6 +42,8 @@ public class thirdPersonController : MonoBehaviour { public Collider curCollider; + public RaycastHit hit; + @@ -58,7 +60,7 @@ public class thirdPersonController : MonoBehaviour { void FixedUpdate(){ - RaycastHit hit; + //RaycastHit hit; Ray ray = new Ray(transform.position, -Vector3.up); diff --git a/unity_Project/Assets/Textures.meta b/unity_Project/Assets/Textures.meta deleted file mode 100644 index 8915b1d..0000000 --- a/unity_Project/Assets/Textures.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 97def69cc8aa8f0458d67929f23873dd -folderAsset: yes -timeCreated: 1444371283 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/unity_Project/Assets/_Scenes/MainLevel.unity b/unity_Project/Assets/_Scenes/MainLevel.unity index 58fdc5443f7f8fd46cd5d914d8891ca82e92cd0b..ca3781242e98ab540f0d8167094118d01bc9d839 100644 GIT binary patch delta 556 zcmZqZQC!fYD8RrN#>v3proh0!zz<|AOcc-*4Rj4un>f`weA=pmr&&dVW6Xh)`!*X2 zdNWPpcTruy%+TNt6k!BnX&`3s1hE+zf`H6qAm#yLnaLA5#2IBLf8-FClmqe^IS^{{ zp=#v8Y81d~6w%bwK-DOL)hL72sGzB7fvQmjt5E~1QAbnL2UVj1R-*}4qlKns22_nU zSd9)?jV_v+#ZWbRU^V(+H3n#E)voF34|$TB@an?+>$g$PEL_61rj+ZSlDUU)IRAdH!1 hdVw%oN&5?7w(T#3*?FE|(JAng9inr4zz_Bfz5vGQZG`{; delta 493 zcmZ3`qu9`+D8RrN`jmmgjR6Sw85qMDCJJbZK6f!a>B+>9b%w3m_Oko;4Q4>e&6^Y0 z`k7eWfy{`>^778SAXW+x^8m5j8f~x|9W*sFplWnMY9@aV7MOfq zm_t$@P1RzkDg&@dhG3J7(A2DksxbzuF#)MzG@Y!&>Btk1lUSKrCnw`!3&z&%dz~0dg{K#^F|xE9g)ss#({`gUW}_?97sN2i zOs~;m(U{(#%_1`WLj+L80WFs82eeo(yqG>kn5|@b&1FV`={@V%G}>)M*tXk