Beispiel #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);
            }
        }
Beispiel #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();
            }
        }
Beispiel #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();
        }
Beispiel #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);
            }
        }
Beispiel #5
0
 public abstract void PlaySFX(SoundFxPair clip);
        public AudioClip GetMusic(SoundFXType type)
        {
            SoundFxPair pair = AmbienceClips.Find(x => x.Type == type);

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