void Update()
{
//Debug.Log (isAnythingPlaying);
//Checks if player is walking
if (god.LH != 0.0f || god.LV != 0.0f) {
//Debug.Log ("Walking, bitch");
isWalking = true;
d8old = d8;
while(d8==d8old){
d8=Random.Range(0, 7);
}
//Debug.Log (d8);
} else {
//Debug.Log("Standing still dude");
isWalking = false;
}
isRPlaying = false;
isMPlaying = false;
isAPlaying = false;
isSPlaying = false;
isPPlaying = false;
isKPlaying = false;
isWPlaying = false;
//Checks if there is a surface beneath the player
if (isWalking == true && Physics.Raycast (transform.position, -Vector3.up, out hit, 3)) {
//Debug.Log ("There is a floor beneath me");
if(/*hit.collider.gameObject.tag == "Puddle Floor" && */isAnythingPlaying == false){
//Stops all sounds, plays a footstep, then starts playing a new footstep every .5 sec
switch(hit.collider.gameObject.tag){
case "Stone Floor":
isRPlaying = true;
ShutUp();
RData[d8].GetComponent<AudioSource>().Play ();
RData[d8].GetComponent<AudioSource>().volume=1;
StartCoroutine(RPlayer());
break;
case "Moss Floor":
isMPlaying = true;
ShutUp();
MData[d8].GetComponent<AudioSource>().Play ();
MData[d8].GetComponent<AudioSource>().volume=1;
StartCoroutine(MPlayer());
break;
case "Sand on Stone Floor":
isAPlaying = true;
ShutUp();
AData[d8].GetComponent<AudioSource>().Play ();
AData[d8].GetComponent<AudioSource>().volume=1;
StartCoroutine(APlayer());
break;
case "Sand Floor":
isSPlaying = true;
ShutUp();
SData[d8].GetComponent<AudioSource>().Play ();
SData[d8].GetComponent<AudioSource>().volume=1;
StartCoroutine(SPlayer());
break;
case "Puddle Floor":
isPPlaying = true;
ShutUp();
PData[d8].GetComponent<AudioSource>().Play ();
PData[d8].GetComponent<AudioSource>().volume=1;
StartCoroutine(PPlayer());
break;
case "Water Floor":
isKPlaying = true;
ShutUp();
KData[d8].GetComponent<AudioSource>().Play ();
KData[d8].GetComponent<AudioSource>().volume=1;
StartCoroutine(KPlayer());
break;
case "Wooden Floor":
isWPlaying = true;
ShutUp();
WData[d8].GetComponent<AudioSource>().Play ();
WData[d8].GetComponent<AudioSource>().volume=1;
StartCoroutine(WPlayer());
break;
case "Room1Tablet":
ShutUp();
StartCoroutine(WPlayer());
break;
default:
StartCoroutine(NPlayer());
break;
}
isAnythingPlaying=true;
//Debug.Log ("Walking in a puddle");
//Debug.Log (d8);
}
}
}