Okay. I have a script of footstep where if you walk, footstep sound will be heard. But I want to make it different when we go to different surface
I got 2 different surface in my game, cement and water. I already got footstep for cement but how to change footstep to water sound when we get in the water?
Here’s the script of footstep
var Steps : AudioClip[];
private var isWalking : boolean = false;
private var controller : CharacterController;
function Awake()
{
controller = GetComponent(CharacterController);
}
function Update()
{
if(controller.velocity.sqrMagnitude > 0.15 )
{
isWalking = true;
}
else
{
isWalking = false;
}
}
InvokeRepeating("Walking", 1.0, 0.6);
function Walking()
{
if(isWalking)
{
AudioSource.PlayClipAtPoint(Steps[Random.Range(0,Steps.length)], gameObject.transform.position);
}
}
I got this script from tutorial on Youtube. I don’t make this script.
Do I need to change something in it? Or I need to make another script. I’m really noob at programming. I know the basics but not like this advance.