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();
        }
예제 #2
0
        public override void createParticle()
        {
            SmokeParticle             particle         = new SmokeParticle(base.particleParams);
            ScaleOverTimeEffectParams scaleEffectParms = new ScaleOverTimeEffectParams {
                Reference = particle,
                ScaleBy   = new Vector2(.1f, .075f)
            };

            particle.addEffect(new ScaleOverTimeEffect(scaleEffectParms));
            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      = Color.Black
            };

            particle.addEffect(new FadeEffect(fadeEffectParms));

            base.particles.Add(particle);
            base.createParticle();
        }
        public override void createParticle()
        {
            int   positionX = base.RANDOM.Next(MAX_RANGE_FROM_EMITTER);
            int   positionY = base.RANDOM.Next(MAX_RANGE_FROM_EMITTER);
            int   positionDirectionX = base.RANDOM.Next(2);
            int   positionDirectionY = base.RANDOM.Next(2);
            float directionX = base.RANDOM.Next(MIN_PARTICLE_SPEED, MAX_PARTICLE_SPEED);
            float directionY = base.RANDOM.Next(MIN_PARTICLE_SPEED, MAX_PARTICLE_SPEED);
            float x, y;

            if (positionDirectionX == 0)
            {
                x = this.position.X + positionX;
            }
            else
            {
                x           = this.position.X - positionX;
                directionX *= -1;
            }

            if (positionDirectionY == 0)
            {
                y = this.position.Y + positionY;
            }
            else
            {
                y           = this.position.Y - positionY;
                directionY *= -1;
            }

            // setup the particle rotation
            float rotationSpeed     = (float)base.RANDOM.Next(MAX_ROTATION_SPEED);
            int   rotationDirection = base.RANDOM.Next(2);

            if (rotationDirection == 0)
            {
                rotationSpeed *= -1;
            }


            base.particleParams.Position  = new Vector2(x, y);
            base.particleParams.Direction = new Vector2(directionX, directionY);
            base.particleParams.Texture   = this.PARTICLE_TEXTURES[base.RANDOM.Next(this.PARTICLE_TEXTURES.Length)];
            ExplosionParticle          particle          = new ExplosionParticle(base.particleParams);
            RotateOverTimeEffectParams rotateEffectParms = new RotateOverTimeEffectParams {
                Reference = particle,
                RotateBy  = rotationSpeed
            };

            particle.addEffect(new RotateOverTimeEffect(rotateEffectParms));

            base.particles.Add(new ExplosionParticle(base.particleParams));
            base.createParticle();
        }
        public override void createParticle()
        {
            int   positionX = this.RANDOM.Next(MAX_RANGE_FROM_EMITTER);
            int   positionY = this.RANDOM.Next(MAX_RANGE_FROM_EMITTER);
            int   directionX = this.RANDOM.Next(2);
            int   directionY = this.RANDOM.Next(2);
            float x, y;

            if (directionX == 0)
            {
                x = PlayerPosition.X + positionX;
            }
            else
            {
                x = PlayerPosition.X - positionX;
            }

            if (directionY == 0)
            {
                y = PlayerPosition.Y + positionY;
            }
            else
            {
                y = PlayerPosition.Y - positionY;
            }

            base.particleParams.Position = new Vector2(x, y);
            BaseParticle2D            particle = new BaseParticle2D(base.particleParams);
            ScaleOverTimeEffectParams effectParms = new ScaleOverTimeEffectParams {
                Reference = particle,
                ScaleBy   = new Vector2(.5f)
            };

            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();
        }
 /// <summary>
 /// Constructs a ScaleOverTimeEffect
 /// </summary>
 /// <param name="parms">RotateOverTimeEffectParams object</param>
 public RotateOverTimeEffect(RotateOverTimeEffectParams parms)
     : base(parms)
 {
     this.RotateBy = parms.RotateBy;
 }