public override void Attack(int cell)
        {
            base.Attack(cell);

            Speed.Set(0, -FallSpeed);
            Acc.Set(0, FallSpeed * 4);
        }
Exemple #2
0
        public override void Update()
        {
            base.Update();

            Am = Left / Lifespan;
            Acc.Set((_emitter.x - X) * 10, (_emitter.y - Y) * 10);
        }
Exemple #3
0
        public override void Update()
        {
            base.Update();

            Am = (Left / Lifespan) / 2;
            Acc.Set(-Speed.X * 10, -Speed.Y * 10);
        }
Exemple #4
0
        public ElmoParticle()
        {
            Color(0x22EE66);
            Lifespan = 0.6f;

            Acc.Set(0, -80);
        }
Exemple #5
0
        public BloodParticle()
        {
            Color(0xCC0000);
            Lifespan = 0.8f;

            Acc.Set(0, +40);
        }
Exemple #6
0
 public Flame()
     : base(Assets.FIREBALL)
 {
     Frame(pdsharp.utils.Random.Int(2) == 0 ? Flame1 : Flame2);
     Origin.Set(Width / 2, Height / 2);
     Acc.Set(0, ACC);
 }
Exemple #7
0
            public FireParticle()
            {
                Color(0xEE7722);
                Lifespan = 1f;

                Acc.Set(0, +80);
            }
Exemple #8
0
        public FlameParticle()
        {
            Color(0xEE7722);
            Lifespan = 0.6f;

            Acc.Set(0, -80);
        }
Exemple #9
0
        public EarthParticle()
        {
            Lifespan = 0.5f;

            Color(ColorMath.Random(0x555555, 0x777766));

            Acc.Set(0, +40);
        }
Exemple #10
0
        public override void Revive()
        {
            base.Revive();

            Speed.Set(0);
            Acc.Set(0);
            dropInterval = 0;

            heap = null;
        }
Exemple #11
0
        public virtual void Reset(float x, float y)
        {
            Revive();

            X = x;
            Y = y;

            Left = Lifespan;

            Acc.Set(0);
            Speed.Set(Random.Float(-40, +40), Random.Float(-40, +40));
        }
Exemple #12
0
        public virtual void Reset(float x, float y, Emitter emitter)
        {
            Revive();

            X        = x;
            Y        = y;
            _emitter = emitter;

            Left = Lifespan;

            Acc.Set(0);
            Speed.Set(Random.Float(-20, +20), Random.Float(-20, +20));
        }
Exemple #13
0
            public Effect(CharSprite sprite, int fromPoint, int to, Pushing pushing)
                : base(0, 0, 0, 0)
            {
                _sprite  = sprite;
                _pushing = pushing;
                Point(sprite.WorldToCamera(fromPoint));
                _end = sprite.WorldToCamera(to);

                Speed.Set(2 * (_end.X - X) / Delay, 2 * (_end.Y - Y) / Delay);
                Acc.Set(-Speed.X / Delay, -Speed.Y / Delay);

                _delay = 0;

                sprite.Parent.Add(this);
            }
        public override void OnComplete(Animation anim)
        {
            base.OnComplete(anim);

            if (anim != AttackAnimation)
            {
                return;
            }

            Speed.Set(0);
            Acc.Set(0);
            Place(Ch.pos);

            Camera.Main.Shake(4, 0.2f);
        }
Exemple #15
0
        public virtual void Drop()
        {
            if (heap.IsEmpty)
            {
                return;
            }

            dropInterval = DROP_INTERVAL;

            Speed.Set(0, -100);
            Acc.Set(0, -Speed.Y / DROP_INTERVAL * 2);

            if (IsVisible && heap != null && heap.Peek() is Gold)
            {
                CellEmitter.Center(heap.Pos).Burst(Speck.Factory(Speck.COIN), 5);
                Sample.Instance.Play(Assets.SND_GOLD, 1, 1, pdsharp.utils.Random.Float(0.9f, 1.1f));
            }
        }
Exemple #16
0
        public override void Update()
        {
            base.Update();

            // Visibility
            Visible = heap == null || Dungeon.Visible[heap.Pos];

            // Dropping
            if (dropInterval > 0 && (dropInterval -= Game.Elapsed) <= 0)
            {
                Speed.Set(0);
                Acc.Set(0);
                Place(heap.Pos);

                if (levels.Level.water[heap.Pos])
                {
                    GameScene.Ripple(heap.Pos);
                }
            }

            // Glowing
            if (Visible && glowing != null)
            {
                if (glowUp && (phase += Game.Elapsed) > glowing.Period)
                {
                    glowUp = false;
                    phase  = glowing.Period;
                }
                else if (!glowUp && (phase -= Game.Elapsed) < 0)
                {
                    glowUp = true;
                    phase  = 0;
                }

                float value = phase / glowing.Period * 0.6f;

                Rm = Gm = Bm = 1 - value;
                RA = glowing.Red * value;
                Ga = glowing.Green * value;
                Ba = glowing.Blue * value;
            }
        }
Exemple #17
0
            public Speck(float x0, float y0, int mx, int my)
            {
                Color(0x4488CC);

                var x1 = x0 + mx * 3;
                var y1 = y0 + my * 3;

                var p = new PointF().Polar(pdsharp.utils.Random.Float(2 * PointF.Pi), 8);

                x0 += p.X;
                y0 += p.Y;

                var dx = x1 - x0;
                var dy = y1 - y0;

                X = x0;
                Y = y0;
                Speed.Set(dx, dy);
                Acc.Set(-dx / 4, -dy / 4);

                Left = Lifespan = 2f;
            }
Exemple #18
0
        public virtual void Reset(int index, float x, float y, int type)
        {
            Revive();

            _type = type;
            switch (type)
            {
            case DISCOVER:
                Frame(_film.Get(LIGHT));
                break;

            case EVOKE:
            case MASTERY:
            case KIT:
            case FORGE:
                Frame(_film.Get(STAR));
                break;

            case RATTLE:
                Frame(_film.Get(BONE));
                break;

            case JET:
            case TOXIC:
            case PARALYSIS:
            case CONFUSION:
            case DUST:
                Frame(_film.Get(STEAM));
                break;

            default:
                Frame(_film.Get(type));
                break;
            }

            X = x - Origin.X;
            Y = y - Origin.Y;

            ResetColor();
            Scale.Set(1);
            Speed.Set(0);
            Acc.Set(0);
            Angle        = 0;
            AngularSpeed = 0;

            switch (type)
            {
            case HEALING:
                Speed.Set(0, -20);
                _lifespan = 1f;
                break;

            case STAR:
                Speed.Polar(pdsharp.utils.Random.Float(2 * 3.1415926f), pdsharp.utils.Random.Float(128));
                Acc.Set(0, 128);
                Angle        = pdsharp.utils.Random.Float(360);
                AngularSpeed = pdsharp.utils.Random.Float(-360, +360);
                _lifespan    = 1f;
                break;

            case FORGE:
                Speed.Polar(pdsharp.utils.Random.Float(-3.1415926f, 0), pdsharp.utils.Random.Float(64));
                Acc.Set(0, 128);
                Angle        = pdsharp.utils.Random.Float(360);
                AngularSpeed = pdsharp.utils.Random.Float(-360, +360);
                _lifespan    = 0.51f;
                break;

            case EVOKE:
                Speed.Polar(pdsharp.utils.Random.Float(-3.1415926f, 0), 50);
                Acc.Set(0, 50);
                Angle        = pdsharp.utils.Random.Float(360);
                AngularSpeed = pdsharp.utils.Random.Float(-180, +180);
                _lifespan    = 1f;
                break;

            case KIT:
                Speed.Polar(index * 3.1415926f / 5, 50);
                Acc.Set(-Speed.X, -Speed.Y);
                Angle        = index * 36;
                AngularSpeed = 360;
                _lifespan    = 1f;
                break;

            case MASTERY:
                Speed.Set(pdsharp.utils.Random.Int(2) == 0 ? pdsharp.utils.Random.Float(-128, -64) : pdsharp.utils.Random.Float(+64, +128), 0);
                AngularSpeed = Speed.X < 0 ? -180 : +180;
                Acc.Set(-Speed.X, 0);
                _lifespan = 0.5f;
                break;

            case LIGHT:
                Angle        = pdsharp.utils.Random.Float(360);
                AngularSpeed = 90;
                _lifespan    = 1f;
                break;

            case DISCOVER:
                Angle        = pdsharp.utils.Random.Float(360);
                AngularSpeed = 90;
                _lifespan    = 0.5f;
                Am           = 0;
                break;

            case QUESTION:
                _lifespan = 0.8f;
                break;

            case UP:
                Speed.Set(0, -20);
                _lifespan = 1f;
                break;

            case SCREAM:
                _lifespan = 0.9f;
                break;

            case BONE:
                _lifespan = 0.2f;
                Speed.Polar(pdsharp.utils.Random.Float(2 * 3.1415926f), 24 / _lifespan);
                Acc.Set(0, 128);
                Angle        = pdsharp.utils.Random.Float(360);
                AngularSpeed = 360;
                break;

            case RATTLE:
                _lifespan = 0.5f;
                Speed.Set(0, -200);
                Acc.Set(0, -2 * Speed.Y / _lifespan);
                Angle        = pdsharp.utils.Random.Float(360);
                AngularSpeed = 360;
                break;

            case WOOL:
                _lifespan = 0.5f;
                Speed.Set(0, -50);
                Angle        = pdsharp.utils.Random.Float(360);
                AngularSpeed = pdsharp.utils.Random.Float(-360, +360);
                break;

            case ROCK:
                Angle        = pdsharp.utils.Random.Float(360);
                AngularSpeed = pdsharp.utils.Random.Float(-360, +360);
                Scale.Set(pdsharp.utils.Random.Float(1, 2));
                Speed.Set(0, 64);
                _lifespan = 0.2f;
                Y        -= Speed.Y * _lifespan;
                break;

            case NOTE:
                AngularSpeed = pdsharp.utils.Random.Float(-30, +30);
                Speed.Polar((AngularSpeed - 90) * PointF.G2R, 30);
                _lifespan = 1f;
                break;

            case CHANGE:
                Angle = pdsharp.utils.Random.Float(360);
                Speed.Polar((Angle - 90) * PointF.G2R, pdsharp.utils.Random.Float(4, 12));
                _lifespan = 1.5f;
                break;

            case HEART:
                Speed.Set(pdsharp.utils.Random.Int(-10, +10), -40);
                AngularSpeed = pdsharp.utils.Random.Float(-45, +45);
                _lifespan    = 1f;
                break;

            case BUBBLE:
                Speed.Set(0, -15);
                Scale.Set(pdsharp.utils.Random.Float(0.8f, 1));
                _lifespan = pdsharp.utils.Random.Float(0.8f, 1.5f);
                break;

            case STEAM:
                Speed.Y      = -pdsharp.utils.Random.Float(20, 30);
                AngularSpeed = pdsharp.utils.Random.Float(+180);
                Angle        = pdsharp.utils.Random.Float(360);
                _lifespan    = 1f;
                break;

            case JET:
                Speed.Y      = +32;
                Acc.Y        = -64;
                AngularSpeed = pdsharp.utils.Random.Float(180, 360);
                Angle        = pdsharp.utils.Random.Float(360);
                _lifespan    = 0.5f;
                break;

            case TOXIC:
                Hardlight(0x50FF60);
                AngularSpeed = 30;
                Angle        = pdsharp.utils.Random.Float(360);
                _lifespan    = pdsharp.utils.Random.Float(1f, 3f);
                break;

            case PARALYSIS:
                Hardlight(0xFFFF66);
                AngularSpeed = -30;
                Angle        = pdsharp.utils.Random.Float(360);
                _lifespan    = pdsharp.utils.Random.Float(1f, 3f);
                break;

            case CONFUSION:
                Hardlight(pdsharp.utils.Random.Int(0x1000000) | 0x000080);
                AngularSpeed = pdsharp.utils.Random.Float(-20, +20);
                Angle        = pdsharp.utils.Random.Float(360);
                _lifespan    = pdsharp.utils.Random.Float(1f, 3f);
                break;

            case DUST:
                Hardlight(0xFFFF66);
                Angle = pdsharp.utils.Random.Float(360);
                Speed.Polar(pdsharp.utils.Random.Float(2 * 3.1415926f), pdsharp.utils.Random.Float(16, 48));
                _lifespan = 0.5f;
                break;

            case COIN:
                Speed.Polar(-PointF.Pi * pdsharp.utils.Random.Float(0.3f, 0.7f), pdsharp.utils.Random.Float(48, 96));
                Acc.Y     = 256;
                _lifespan = -Speed.Y / Acc.Y * 2;
                break;
            }

            _left = _lifespan;
        }
Exemple #19
0
        public PoisonParticle()
        {
            Lifespan = 0.6f;

            Acc.Set(0, +30);
        }
Exemple #20
0
 public FlowParticle()
 {
     Lifespan = 0.6f;
     Acc.Set(0, 32);
     AngularSpeed = Random.Float(-360, +360);
 }
Exemple #21
0
 public LeafParticle()
 {
     Lifespan = 1.2f;
     Acc.Set(0, 25);
 }
Exemple #22
0
        public WoolParticle()
        {
            Color(ColorMath.Random(0x999999, 0xEEEEE0));

            Acc.Set(0, -40);
        }
Exemple #23
0
        public SparkParticle()
        {
            Size(2);

            Acc.Set(0, +50);
        }