so i have this *very bad* code of a footstep sound effect that activates a sound each step when grounded but thats it, ive tried researching on how i can multiply the sound each step when sprinting but i couldnt find any solution, any tips on how i should go with this? what code should i add to mutiply the sound when sprinting?
public Rigidbody rb;
public playermovement movement;
public AudioSource audioSrc;
void Start()
{
rb = GetComponent();
movement = GetComponent();
audioSrc = GetComponent();
}
void Update()
{
if(movement.isGrounded == true && rb.velocity.magnitude > 2f && GetComponent().isPlaying == false)
{
GetComponent().Play();
}
}
↧