コード例 #1
0
        public void Burst()
        {
            for (int i = 0; i < 4; i++)
            {
                //Params:
                //0: x-speed initial
                //1: y-speed initial
                //2: x-accel
                //3: y-accel
                //4: x source
                //5: y source
                Particle p = new Particle(RNG.Next(-1000, 1000), RNG.Next(-1000, 1000), 0, 0, _SourceX, _SourceY);

                p.Params[2] = 2 * ((_TargetX - _SourceX) - p.Params[0] * TrackingTime) / (TrackingTime * TrackingTime);
                p.Params[3] = 2 * ((_TargetY - _SourceY) - p.Params[1] * TrackingTime) / (TrackingTime * TrackingTime);

                p.TimeToLive = TrackingTime;
                p.X          = _SourceX;
                p.Y          = _SourceY;
                p.Scale      = 64 / 256.0f;
                p.Color      = _Color;

                p.Transform += TrackToTarget;

                Animation frame = AnimationFactory.GenerateAnimation(@"Lensflare", 256, 256, 1, 0);

                p.Sprite = new Sprite(frame, new Vector2(200, 200));
                //p.Sprite.Animation.CurrentFrame = RNG.Next(5);

                this.Add(p);
            }
        }
コード例 #2
0
ファイル: ParticleEffect_A.cs プロジェクト: fchorney/BlockXNA
        public override void Update(GameTime gameTime)
        {
            _Limiter.Update(gameTime);
            if (_Limiter.Ready && true)
            {
                //Params:
                //0: x-speed
                //1: y-speed
                Particle p = CreateParticle(RNG.Next(-200, 200), RNG.Next(-100, 100), RNG.Next(-100, 100));
                p.TimeToLive = 20;
                p.X          = x;
                p.Y          = y;
                p.Scale      = 0.1f;

                p.Transform  = null;
                p.Transform += SinXFunction;
                p.Transform += SinYFunction;

                Animation frame = AnimationFactory.GenerateAnimation(@"Lensflare", 256, 256, 1, 0);

                p.Sprite = new Sprite(frame, new Vector2(100, 100));
                // p.Sprite.Animation.CurrentFrame = RNG.Next(5);

                this.Add(p);
            }

            base.Update(gameTime);
        }
コード例 #3
0
        public void Burst()
        {
            Particle p = new Particle();

            p.TimeToLive = ExplodeTime;
            p.X          = _SourceX;
            p.Y          = _SourceY;
            p.Scale      = 128 / 200.0f;
            p.Color      = _Color;

            p.Transform += TrackToTarget;

            Animation frame = AnimationFactory.GenerateAnimation(@"Explosion", 200, 200, 6, 0.06);

            p.Sprite = new Sprite(frame, new Vector2(-200, -200));

            this.Add(p);
        }