using System.Collections; using System.Collections.Generic; using UnityEngine; public class SoundManager : MonoBehaviour { public AudioSource audioSource; public bool isMainCharacter; public AudioClip acAttention; public AudioClip acReady; public AudioClip acStart; public AudioClip[] acTK; //public AudioClip[] acTK2; public AudioClip acPunch; public AudioClip acKick; public AudioClip acShout; public Animator anim; // public PlayManager playManager; private float delayTime = 1f; public PlayManager playManager; // Start is called before the first frame update void Start() { // isOnVoice = true; audioSource = gameObject.GetComponent(); if(gameObject.GetComponent() != null) { isMainCharacter = true; } playManager = GameObject.Find("PlayManager").GetComponent(); } void DividePoomSea() { if (isMainCharacter && playManager.divideState == PlayManager.DivideState.On) { playManager.Pause(); } if (isMainCharacter && playManager.divideState == PlayManager.DivideState.Auto) { playManager.Pause(); Invoke("ResetSpeed", delayTime); } } void ResetSpeed() { //if (playManager.isDividePlay) //if (playManager.) //{ playManager.Play(); //} } void AudioPlay_Attention() { if (isMainCharacter && playManager.currentSpeedIndex < 3) { audioSource.clip = acAttention; audioSource.Play(); } } void AudioPlay_Ready() { if (isMainCharacter && playManager.currentSpeedIndex < 3) { audioSource.clip = acReady; audioSource.Play(); } } void AudioPlay_TK(int poomseaIndex) { if (isMainCharacter && playManager.currentSpeedIndex < 3) { audioSource.clip = acTK[poomseaIndex]; audioSource.Play(); } } void AudioPlay_Start() { if (isMainCharacter && playManager.currentSpeedIndex < 3) { audioSource.clip = acStart; audioSource.Play(); } } void AudioPlay_Punch() { if (isMainCharacter) { audioSource.clip = acPunch; audioSource.Play(); } } void AudioPlay_Kick() { if (isMainCharacter) { audioSource.clip = acKick; audioSource.Play(); } } void AudioPlay_Shout() { if (isMainCharacter) { audioSource.clip = acShout; audioSource.Play(); } } }