public override void PlayAndDestroy()
        {
            if (factory.IsNull())
            {
                DespawnSelf();
                return;
            }

            if (isPlaying)
            {
                return;
            }

            if (!factory.ParticleFactory.IsNull())
            {
                psObj = factory.ParticleFactory.Create(xform);
                PoolManager.SetOnDespawnedCallback(psObj.transform, OnParticleObjectDespawned);
                psObj.PlayAndDestroy();
            }

            if (!factory.SoundFactory.IsNull())
            {
                sndObj = factory.SoundFactory.Create(xform);
                PoolManager.SetOnDespawnedCallback(sndObj.transform, OnSoundObjectDespawned);
                sndObj.PlayAndDestroy();
            }

            isPlaying = true;
        }
Пример #2
0
 public void PlayOneShot()
 {
     if (!effectParams.IsNull())
     {
         effectObj = effectParams.Create(transform);
         effectObj.PlayAndDestroy();
     }
 }
        void OnEnable()
        {
            if (!EffectParams.IsNull())
            {
                effectObj = EffectParams.Create(transform);
            }

            effectObj.PlayAndDestroy();
        }