using System.Collections; using System.Collections.Generic; using UnityEngine; //Thomas09 [RequireComponent(typeof(AudioSource))] public class NPCFootsteps : MonoBehaviour { private AudioSource audioSource; private Animator anim; void Awake() { audioSource = GetComponent(); anim = GetComponent(); } private void PlayFootstep() //used in animation event { float randPitch = Random.Range(0.85f, 1.2f); audioSource.pitch = randPitch; audioSource.PlayOneShot(audioSource.clip); } private void ResetTriggers() //used in animation event. { anim.ResetTrigger("HeadHit"); anim.ResetTrigger("BodyHit"); } }