protected override Particle GenerateNewParticle() { int index = _rand.Next(0, 2); Particle p = new FadeParticle(index, Entity.Body.Position, 20, this); p.TimeToLive = 40; p.Body.Angle = Entity.Body.Angle + (float)_rand.NextDouble() * _rand.Next(-1, 2); p.Physics.Thrust((float)_rand.NextDouble() * 2); p.Render.Scale = (float)_rand.NextDouble() + 1f; return(p); }
protected override Particle GenerateNewParticle() { int index = _rand.Next(0, 3); Particle p = new FadeParticle(index, Entity.Body.Position, 40, this); p.TimeToLive = 100; float angle = (float)_rand.NextDouble() * MathHelper.PiOver2; var anglev = (float)((_rand.NextDouble() - .5f) * 1.25f); p.Body.Angle = angle - anglev; p.Physics.Thrust((float)_rand.NextDouble() * 2); p.Render.Scale = .25f * Entity.Health.HitPoints + .75f; return(p); }
public override void Emit(int amount) { var random = new Random(DateTime.Now.Millisecond); float pislice = MathHelper.TwoPi / amount; for (int i = 0; i < amount; i++) { int index = random.Next(0, 3); float angle = pislice * i; Vector2 position = Entity.Body.Position; var p = new FadeParticle(index, position, 40, this) { Body = { Angle = angle }, TimeToLive = 50 + Entity.Health.HitPoints * 20, Physics = { Drag = 0.99f } }; p.Physics.Thrust(random.Next(1, 4)); p.Render.Scale = (float)random.NextDouble() + .5f; Entity.AddEntity(p); } }
public override void Emit(int amount) { var random = new Random(DateTime.Now.Millisecond); var pislice = MathHelper.TwoPi / amount; for (var i = 0; i < amount; i++) { var index = random.Next(0, 3); var angle = pislice * i; var position = Entity.Body.Position; var p = new FadeParticle(index, position, 40, this) { Body = { Angle = angle - (float)random.NextDouble() }, Physics = { AngularVelocity = (float)random.NextDouble() * .5f - .1f }, TimeToLive = 200 }; p.Physics.Drag = 0.99f; p.Physics.Thrust((float)random.NextDouble() * 2.0f + 1f); p.Render.Scale = (float)random.NextDouble() + .75f; Entity.AddEntity(p); } }