Browse Source

+terrain check when playing footstep sounds

master
Joshua Reason 8 years ago
parent
commit
5bfe2726fc
2 changed files with 9 additions and 16 deletions
  1. +9
    -7
      unity_Project/Assets/Scripts/PlayerSounds.cs
  2. +0
    -9
      unity_Project/Assets/Textures.meta

+ 9
- 7
unity_Project/Assets/Scripts/PlayerSounds.cs View File

@ -47,19 +47,20 @@ public class PlayerSounds : MonoBehaviour {
// > Needs proper logic
// > Purpose of this function is to determine whether the player object is
// standing on the terrain object that has been tagged with "sand".
void CheckGround(ControllerColliderHit FootHit){
void CheckGround(){
//playerCollider = PlayerObject.GetComponent<CapsuleCollider>;
if (FootHit.gameObject.tag == "sand") {
FootOnSand = true;
}
RaycastHit FootHit;
Ray ray = new Ray(transform.position, -Vector3.up);
else {
if (Physics.Raycast (ray, out FootHit, 1.3f)) {
if (FootHit.transform.tag == "sand")
FootOnSand = true;
}else{
FootOnSand = false;
}
}
@ -67,6 +68,7 @@ public class PlayerSounds : MonoBehaviour {
void PlayFootstep(){
float volRandom = Random.Range (volLowRange, volHighRange);
CheckGround ();
// SAND FOOTSTEP SOUND

+ 0
- 9
unity_Project/Assets/Textures.meta View File

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 97def69cc8aa8f0458d67929f23873dd
folderAsset: yes
timeCreated: 1444371283
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

Loading…
Cancel
Save