public override void createParticle() { int nextIndex = -1; do { nextIndex = RANDOM.Next(this.SPAWN_LOCATIONS.Length); } while (this.lastUsedIndex == nextIndex); this.lastUsedIndex = nextIndex; base.particleParams.Position = this.SPAWN_LOCATIONS[this.lastUsedIndex]; ConstantSpeedParticle particle = new ConstantSpeedParticle(base.particleParams); ScaleOverTimeEffectParams effectParms = new ScaleOverTimeEffectParams { Reference = particle, ScaleBy = new Vector2(1f) }; particle.addEffect(new ScaleOverTimeEffect(effectParms)); RotateOverTimeEffectParams rotateEffectParms = new RotateOverTimeEffectParams { Reference = particle, RotateBy = 2f }; particle.addEffect(new RotateOverTimeEffect(rotateEffectParms)); FadeEffectParams fadeEffectParms = new FadeEffectParams { Reference = particle, State = FadeEffect.FadeState.Out, TotalTransitionTime = TIME_TO_LIVE, OriginalColour = COLOUR }; particle.addEffect(new FadeEffect(fadeEffectParms)); base.particles.Add(particle); base.createParticle(); }
public override void createParticle() { if (Emitt) { float x = RANDOM.Next(0, 180); if (RANDOM.Next(0, 2) == 1) { x = -x; } float y = RANDOM.Next(0, 180); if (RANDOM.Next(0, 2) == 1) { y = -y; } float rotation = (float)Math.Atan2(x, -y); BaseParticle2DParams particleParms = new BaseParticle2DParams(); particleParms.TimeToLive = 1000; particleParms.Texture = base.particleTexture; particleParms.Scale = new Vector2(.75f); particleParms.Position = this.position; particleParms.Origin = new Vector2(Constants.TILE_SIZE / 2); particleParms.Direction = new Vector2(x, y); particleParms.Acceleration = new Vector2(.15f); particleParms.Rotation = rotation; particleParms.LightColour = Color.White; ConstantSpeedParticle particle = new ConstantSpeedParticle(particleParms); base.particles.Add(particle); base.createParticle(); } }
public override void createParticle() { Vector2 heading = HEADINGS[base.RANDOM.Next(HEADINGS.Length)]; BaseParticle2DParams particleParms = new BaseParticle2DParams(); particleParms.TimeToLive = 500; particleParms.Origin = this.origin; particleParms.Texture = base.particleTexture; particleParms.Scale = new Vector2(.5f); particleParms.Position = this.position; particleParms.Direction = heading; particleParms.Acceleration = new Vector2(25f, 35f); ConstantSpeedParticle particle = new ConstantSpeedParticle(particleParms); ScaleOverTimeEffectParams effectParms = new ScaleOverTimeEffectParams { ScaleBy = new Vector2(1.75f) }; particle.addEffect(new ScaleOverTimeEffect(effectParms)); if (this.sway) { PulseDirection direction = EnumUtils.numberToEnum <PulseDirection>(base.RANDOM.Next(2)); SwayEffectParms swayEffectParms = new SwayEffectParms { SwayBy = new Vector2(50f, 0f), SwayDownTo = -5f, SwayUpTo = 5f, Direction = direction }; particle.addEffect(new SwayEffect(swayEffectParms)); } SoundManager.getInstance().playSoundEffect(this.sfxEmitter, this.idleSFX); base.particles.Add(particle); base.createParticle(); }