Exemplo n.º 1
0
        public void PlaySound(UnitTypes unitType, UnitSoundType soundType)
        {
            AudioClip[] audioClipArray = soundsDictionary[unitType][soundType];

            var ran          = new System.Random();
            int randomNumber = ran.Next(audioClipArray.Length);

            if (audioSource == null)
            {
                audioSource = Camera.main.gameObject.AddComponent <AudioSource>();
            }

            if (!audioSource.isPlaying)
            {
                audioSource.clip = audioClipArray[randomNumber];
                audioSource.Play();
            }
        }
Exemplo n.º 2
0
 public void PlaySound(UnitSoundType soundType)
 {
     //GameObject.Find("_Scripts").GetComponent<GameManager>().UnitSounds.PlaySound(UnitGameObject.type, soundType);
 }