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); }
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 void SetShowOnlyThisGeneration(IMyParticleGeneration generation) { for (int i = 0; i < m_generations.Count; i++) { if (m_generations[i] == generation) { SetShowOnlyThisGeneration(i); return; } } SetShowOnlyThisGeneration(-1); }
public void AddGeneration(IMyParticleGeneration generation) { m_generations.Add(generation); if (m_instances != null) { foreach (MyParticleEffect effect in m_instances) { effect.AddGeneration(generation.CreateInstance(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 void RemoveGeneration(int index) { IMyParticleGeneration generation = m_generations[index]; m_generations.Remove(generation); generation.Close(); generation.Deallocate(); if (m_instances != null) { foreach (MyParticleEffect effect in m_instances) { effect.RemoveGeneration(index); } } }
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); }
public void RemoveGeneration(IMyParticleGeneration generation) { int index = m_generations.IndexOf(generation); RemoveGeneration(index); }
public void SetShowOnlyThisGeneration(IMyParticleGeneration generation) { for (int i=0; i < m_generations.Count;i++) { if (m_generations[i] == generation) { SetShowOnlyThisGeneration(i); return; } } SetShowOnlyThisGeneration(-1); }