#pragma strict
var footsteps : PlayerFootsteps;
var WoodFloor : BoxCollider;
function Start ()
{
WoodFloor = GameObject.Find("Wood Floor Trigger").GetComponent(BoxCollider);
footsteps = GameObject.Find("First Person Controller").GetComponent(PlayerFootsteps);
}
function OnTriggerEnter (WoodFloor)
{
if (col.tag == "Player")
{
footsteps.OnWood = true;
}
Debug.Log ("Entered Trigger");
}
function OnTriggerExit (Collider col)
{
if(col.tag == "Player")
{
footsteps.OnWood = false;
}
Debug.Log ("Exited Trigger");
}
This detects the colision with the player so you must asign the player with a Player tag.
↧