public void Spawn(int amount) { for (int i = 0; i < amount; i++) { object obj = AssemblyManager.CreateInstance(spawnObj); if (obj != null) { if (obj is GameObject) { Vector2 vec = emitter.GeneratePosition(); Vector3 trans = new Vector3() { X = vec.X, Y = vec.Y, Z = 0 }; ((GameObject)obj).World.Translation = trans; ((GameObject)obj).AddReference(this); spawnedObjects.Add(obj); } } } }
void GenerateParticles(int amount) { for (int i = 0; i < amount; i++) { Particle2D p = new Particle2D("Particle" + particles.Count, emittionType.GeneratePosition(), mass.GetRandomWithin(), lifeTime.GetRandomWithin(), attachments.GeneratePropertySet()); p.OnDead += new OnDeadParticleEvent(ParticleDead); if (renderMethod is IUpdateableRenderer) { ((IUpdateableRenderer)renderMethod).GenerateNew(); } particles.Add(p); } }