Example #1
0
        /*
         * [SerializeField]
         * [Range(1f,3f)]
         * private float ParticlesLifeTime = 2f;
         */

        public override void PlaySFX(SoundFxPair clip)
        {
            if (clip != null)
            {
                AudioManager.Instance.PlaySFX(clip.Clip, clip.Volume);
            }
        }
Example #2
0
        public virtual void Explode(SoundFxPair clip, ParticleSystem ps, Vector3 position)
        {
            PlaySFX(clip);
            PlayParticleSys(ps, position);

            OnExplosionFinished(this, EventArgs.Empty);

            if (ExplosionComplete != null)
            {
                ExplosionComplete();
            }
        }
Example #3
0
        public void PlayMusic(SoundFXType sfxType)
        {
            SoundFxPair pair = audioCollection.GetMusicPair(sfxType);

            if (pair == null)
            {
                return;
            }

            AudioClip clip = pair.Clip;

            if (musicSource.isPlaying && musicSource.clip == clip)
            {
                return;
            }
            musicSource.clip   = clip;
            musicSource.loop   = true;
            musicSource.volume = pair.Volume;
            musicSource.Play();
        }
Example #4
0
        public void PlaySFX(SoundFXType sfxType)
        {
            SoundFxPair pair = audioCollection.GetSfxPair(sfxType);

            if (pair == null)
            {
                return;
            }

            if (!sfxSource.isPlaying && pair != null)
            {
                sfxSource.clip   = pair.Clip;
                sfxSource.volume = pair.Volume;
                sfxSource.Play();
            }
            else
            {
                PlayDynamicSoundFX(pair.Clip, pair.Volume);
            }
        }
Example #5
0
 public abstract void PlaySFX(SoundFxPair clip);
Example #6
0
        public AudioClip GetMusic(SoundFXType type)
        {
            SoundFxPair pair = AmbienceClips.Find(x => x.Type == type);

            return(pair != null ? pair.Clip : null);
        }