Пример #1
0
        public override void Update(float dt)
        {
            base.Update(dt);

            if ((count + 1) * Delay <= T)
            {
                count++;

                if (count == 4)
                {
                    Self.SelectAttack();
                    return;
                }

                var m = new Missile(Self, Self.Target);
                m.AddLight(32f, Projectile.RedLight);

                m.OnDeath += (p, e, t) => {
                    for (var i = 0; i < SmallCount; i++)
                    {
                        var an = (float)(((float)i) / SmallCount * Math.PI * 2);

                        var pp = new ProjectilePattern(CircleProjectilePattern.Make(4.5f, 10 * (i % 2 == 0 ? 1 : -1)))
                        {
                            Position = p.Center
                        };

                        for (var j = 0; j < 2; j++)
                        {
                            var b = Projectile.Make(Self, "small");
                            pp.Add(b);
                            b.Range = 2f;
                            b.AddLight(32f, Projectile.RedLight);
                        }

                        pp.Launch(an, 40);
                        Self.Area.Add(pp);
                    }

                    var a = p.AngleTo(Self.Target);

                    for (var i = 0; i < InnerCount; i++)
                    {
                        var s = Rnd.Chance(40);
                        var b = Projectile.Make(Self, s ? "green_tiny" : "green_small", a + Rnd.Float(-0.3f, 0.3f), Rnd.Float(2, 12), true, 1, p);

                        b.Center = p.Center;
                        b.AddLight(s ? 16f : 32f, Projectile.GreenLight);
                    }
                };
            }
        }
Пример #2
0
        private void Fire()
        {
            var a = GetComponent <MobAnimationComponent>();

            Tween.To(0.4f, a.Scale.X, x => a.Scale.X = x, 0.1f);
            Tween.To(1.8f, a.Scale.Y, x => a.Scale.Y = x, 0.1f).OnEnd = () => {
                Tween.To(1, a.Scale.X, x => a.Scale.X = x, 0.4f);
                Tween.To(1, a.Scale.Y, x => a.Scale.Y = x, 0.4f);

                if (Target != null)
                {
                    var m = new Missile(this, Target);
                    Area.Add(m);
                    m.AddLight(64f, Projectile.RedLight);
                }
            };
        }
Пример #3
0
            public override void Update(float dt)
            {
                base.Update(dt);
                delay -= dt;

                if (delay <= 0)
                {
                    if (count >= 5f)
                    {
                        Become <IdleState>();
                        return;
                    }

                    delay = 3f;
                    count++;

                    Self.GetComponent <BkGraphicsComponent>().Animate();

                    var m = new Missile(Self, Self.Target);
                    Self.Area.Add(m);
                    m.AddLight(64f, Projectile.RedLight);

                    m.HurtOwner = false;
                    m.OnDeath  += (p, e, t) => {
                        for (var i = 0; i < SmallCount; i++)
                        {
                            var an = (float)(((float)i) / SmallCount * Math.PI * 2);

                            var pp = new ProjectilePattern(CircleProjectilePattern.Make(6.5f, 10 * (i % 2 == 0 ? 1 : -1)))
                            {
                                Position = p.Center
                            };

                            for (var j = 0; j < 5; j++)
                            {
                                var b = Projectile.Make(Self, "small");
                                pp.Add(b);
                                b.AddLight(32f, Projectile.RedLight);
                                b.CanBeReflected = false;
                                b.CanBeReflected = false;
                                b.CanBeBroken    = false;
                            }

                            pp.Launch(an, 40);
                            Self.Area.Add(pp);
                        }

                        var aa = Self.AngleTo(Self.Target);

                        for (var i = 0; i < InnerCount; i++)
                        {
                            var b = Projectile.Make(Self, "circle", aa + Rnd.Float(-0.3f, 0.3f), Rnd.Float(2, 12), true, 0, null, Rnd.Float(0.5f, 1f));

                            b.Color          = ProjectileColor.Orange;
                            b.Center         = p.Center;
                            b.CanBeReflected = false;
                            b.CanBeBroken    = false;
                        }
                    };
                }
            }