private void CreateCPUExplosion(Vector2 explosionLocation, Color color) { for (int i = 0; i < CVars.Get <int>("particle_explosion_count"); i++) { float speed = CVars.Get <float>("particle_explosion_strength") * NextRandomSingle(CVars.Get <float>("particle_explosion_variety_min"), CVars.Get <float>("particle_explosion_variety_max")); float dir = NextRandomSingle(0, MathHelper.TwoPi); ref VelocityParticleInfo info = ref _CPUParticleManager.CreateParticle(_particleTexture, explosionLocation.X, -explosionLocation.Y, // For various reasons, ParticleManager is flipped color, float.PositiveInfinity, 1, 0.5f); info.Velocity.X = (float)(speed * Math.Cos(dir)); info.Velocity.Y = (float)(speed * Math.Sin(dir)); info.LengthMultiplier = 1f; }
void CreateExplosion(Vector2 position) { for (int i = 0; i < 150; i++) { float speed = 2000 * (1f - 1 / _random.NextSingle(1, 10)); float dir = _random.NextSingle(0, MathHelper.TwoPi); VelocityParticleInfo info = new VelocityParticleInfo() { Velocity = new Vector2((float)(speed * Math.Cos(dir)), (float)(speed * Math.Sin(dir))), LengthMultiplier = 1f, EdgeEntities = _edgeEntities }; _owner.VelocityParticleManager.CreateParticle(_owner.Content.Load <Texture2D>(Constants.Resources.TEXTURE_PARTICLE_VELOCITY), position, Color.White, 150, Vector2.One, info); } }