void Death() { if (death) { Common_AudioManager.PlaySound(death, transform.position); } }
void Sleeping() { if (sleeping) { Common_AudioManager.PlaySound(sleeping, transform.position); } }
void Attacking() { if (attacking) { Common_AudioManager.PlaySound(attacking, transform.position); } }
void Running() { if (running) { Common_AudioManager.PlaySound(running, transform.position); } }
void Eating() { if (eating) { Common_AudioManager.PlaySound(eating, transform.position); } }
void Walking() { if (walking) { Common_AudioManager.PlaySound(walking, transform.position); } }
void AnimalSound() { if (animalSound) { Common_AudioManager.PlaySound(animalSound, transform.position); } }
private void Awake() { instance = this; for (int i = 0; i < objectPoolLength; i++) { GameObject soundObject = new GameObject(); soundObject.transform.SetParent(instance.transform); soundObject.name = "Sound Effect"; AudioSource audioSource = soundObject.AddComponent <AudioSource>(); audioSource.spatialBlend = 1f; audioSource.minDistance = instance.soundDistance; audioSource.gameObject.SetActive(false); pool.Add(audioSource); } }