示例#1
0
 protected void PlayParticleEffect()
 {
     if (config.GetParticlePrefab() != null)
     {
         GameObject go = Instantiate(config.GetParticlePrefab(), transform);
         go.transform.parent = null; //Maybe parent to the "Caster" and put the simulation space of the particle to world space.
         Destroy(go, PARTICLE_CLEANUP_DELAY);
     }
 }
        protected void PlayParticleEffect()
        {
            var particlePrefab = config.GetParticlePrefab();
            var particleObject = Instantiate(particlePrefab, transform.position, particlePrefab.transform.rotation);

            particleObject.transform.parent = transform; // Set world space in prefab if required
            ParticleSystem myParticleSystem = particleObject.GetComponent <ParticleSystem>();

            myParticleSystem.Play();

            float totalDuration = myParticleSystem.main.duration + myParticleSystem.main.startLifetime.constant; // Fixes duration bug

            Destroy(particleObject, totalDuration);
        }
        protected void PlayParticleEffect()
        {
            var particleObject = Instantiate(config.GetParticlePrefab(), transform.position, config.GetParticlePrefab().transform.rotation);

            particleObject.transform.parent = transform;
            particleObject.GetComponent <ParticleSystem>().Play();
            StartCoroutine(DestroyParticleWhenFinished(particleObject));
        }
示例#4
0
        protected void PlayParticleEffect()
        {
            GameObject particlePrefab = config.GetParticlePrefab();
            GameObject particleObject = Instantiate(particlePrefab, transform.position, particlePrefab.transform.rotation);

            particleObject.transform.SetParent(transform);
            particleObject.GetComponent <ParticleSystem>().Play();

            StartCoroutine(DestroyParticleWhenFinished(particleObject));
        }
        protected void PlayParticleEffect()
        {
            var particlePrefab = config.GetParticlePrefab();
            var particleObject = Instantiate(particlePrefab,
                                             transform.position,
                                             particlePrefab.transform.rotation
                                             );          // TODO player parent or in world?

            particleObject.transform.parent = transform; // set world space in prefab if required
            particleObject.GetComponent <ParticleSystem>().Play();
            StartCoroutine(DestroyParticleWhenFinished(particleObject));
        }
示例#6
0
        protected void PlayParticleEffect()
        {
            // instantiate a particle system prefab attached to player
            // config.GetParticlePrefab() - get the particle prefab from the config
            // transform.position from the player because this behaviour is attached to the player
            var particlePrefab = config.GetParticlePrefab();
            var particleObject = Instantiate(
                particlePrefab,
                transform.position,
                particlePrefab.transform.rotation
                );

            // take the transform parent from the particle spawned and set it to ourselves, so the particle will always be nested to the gameObject that has the particle
            particleObject.transform.parent = transform; // set world space in prefab if required
            particleObject.GetComponent <ParticleSystem>().Play();
            DestroyParticleWhenFinished(particleObject);
        }