Beispiel #1
0
        public MyParticleEffect Duplicate()
        {
            MyParticleEffect effect = MyParticlesManager.EffectsPool.Allocate();

            effect.Start(0);

            effect.Name        = Name;
            effect.m_length    = m_length;
            effect.DurationMin = m_durationMin;
            effect.DurationMax = m_durationMax;
            effect.Loop        = m_loop;

            foreach (IMyParticleGeneration generation in m_generations)
            {
                IMyParticleGeneration duplicatedGeneration = generation.Duplicate(effect);
                effect.AddGeneration(duplicatedGeneration);
            }

            foreach (var particleLight in m_particleLights)
            {
                var newParticleLight = (MyParticleLight)particleLight.Duplicate(effect);
                effect.AddParticleLight(newParticleLight);
            }

            foreach (var particleSound in m_particleSounds)
            {
                var newParticleSound = (MyParticleSound)particleSound.Duplicate(effect);
                effect.AddParticleSound(newParticleSound);
            }

            return(effect);
        }
Beispiel #2
0
        public MyParticleEffect CreateInstance()
        {
            MyParticleEffect effect = MyParticlesManager.EffectsPool.Allocate(true);

            if (effect != null)
            {
                effect.Start(m_particleID);

                effect.Name          = Name;
                effect.Enabled       = Enabled;
                effect.Length        = Length;
                effect.m_globalScale = m_globalScale;
                effect.LowRes        = LowRes;
                effect.Loop          = m_loop;
                effect.DurationMin   = m_durationMin;
                effect.DurationMax   = m_durationMax;
                effect.SetRandomDuration();

                foreach (IMyParticleGeneration generation in m_generations)
                {
                    IMyParticleGeneration gen = generation.CreateInstance(effect);
                    if (gen != null)
                    {
                        effect.AddGeneration(gen);
                    }
                }

                foreach (MyParticleLight particleLight in m_particleLights)
                {
                    MyParticleLight pl = particleLight.CreateInstance(effect);
                    if (pl != null)
                    {
                        effect.AddParticleLight(pl);
                    }
                }

                foreach (MyParticleSound particleSound in m_particleSounds)
                {
                    MyParticleSound ps = particleSound.CreateInstance(effect);
                    if (ps != null)
                    {
                        effect.AddParticleSound(ps);
                    }
                }

                if (m_instances == null)
                {
                    m_instances = new List <MyParticleEffect>();
                }

                m_instances.Add(effect);
            }

            return(effect);
        }
        public MyParticleEffect CreateInstance()
        {
            MyParticleEffect effect = MyParticlesManager.EffectsPool.Allocate(true);

            if (effect != null)
            {
                effect.Start(m_particleID);

                effect.Name    = Name;
                effect.Enabled = Enabled;
                effect.SetLength(GetLength());
                effect.SetPreload(GetPreload());
                effect.LowRes = LowRes;

                foreach (IMyParticleGeneration generation in m_generations)
                {
                    IMyParticleGeneration gen = generation.CreateInstance(effect);
                    if (gen != null)
                    {
                        effect.AddGeneration(gen);
                    }
                }

                foreach (MyParticleLight particleLight in m_particleLights)
                {
                    MyParticleLight pl = particleLight.CreateInstance(effect);
                    if (pl != null)
                    {
                        effect.AddParticleLight(pl);
                    }
                }

                foreach (MyParticleSound particleSound in m_particleSounds)
                {
                    MyParticleSound ps = particleSound.CreateInstance(effect);
                    if (ps != null)
                    {
                        effect.AddParticleSound(ps);
                    }
                }

                if (m_instances == null)
                {
                    m_instances = new List <MyParticleEffect>();
                }

                m_instances.Add(effect);
            }

            return(effect);
        }
        public MyParticleEffect Duplicate()
        {
            MyParticleEffect effect = MyParticlesManager.EffectsPool.Allocate();

            effect.Start(0);

            effect.Name      = Name;
            effect.m_preload = m_preload;
            effect.m_length  = m_length;

            foreach (IMyParticleGeneration generation in m_generations)
            {
                IMyParticleGeneration duplicatedGeneration = generation.Duplicate(effect);
                effect.AddGeneration(duplicatedGeneration);
            }

            return(effect);
        }