private void Start() { if (!usedByNPC) { audioSource = GetComponent <AudioSource>(); collisionTag = GetComponentInParent <GetCollisionTag>(); } if (usedByNPC) { agent = GetComponentInParent <NavMeshAgent>(); collisionTag = GetComponent <GetCollisionTag>(); } }
public void PlayFootstep() { switch (collisionTag.contactTag) { case "Dirt": AkSoundEngine.PostEvent(footstepsSFX, gameObject); break; case "Wood": AkSoundEngine.SetSwitch("footsteps", "wood", gameObject); AkSoundEngine.PostEvent(footstepsSFX, gameObject); collisionTagBuffer = collisionTag; break; case "Concrete": AkSoundEngine.SetSwitch("footsteps", "concrete", gameObject); AkSoundEngine.PostEvent(footstepsSFX, gameObject); collisionTagBuffer = collisionTag; break; case "Metal": AkSoundEngine.SetSwitch("footsteps", "metal", gameObject); AkSoundEngine.PostEvent(footstepsSFX, gameObject); collisionTagBuffer = collisionTag; break; case "Water": AkSoundEngine.SetSwitch("footsteps", "water", gameObject); AkSoundEngine.PostEvent(footstepsSFX, gameObject); collisionTagBuffer = collisionTag; break; case "Sand": AkSoundEngine.SetSwitch("footsteps", "sand", gameObject); AkSoundEngine.PostEvent(footstepsSFX, gameObject); collisionTagBuffer = collisionTag; break; default: AkSoundEngine.SetSwitch("footsteps", collisionTagBuffer.contactTag, gameObject); AkSoundEngine.PostEvent(footstepsSFX, gameObject); break; } }
private void Start() { collisionTag = GameObject.Find("Player").GetComponent <GetCollisionTag>(); }