public override void OnPressAction()
 {
     base.OnPressAction();
     if (duck != null && cooldown3 == 0)
     {
         var firedBullets = new List <Bullet>(10);
         if (duck.offDir != 1)
         {
             for (int i = 0; i < 10; i++)
             {
                 Bullet b = Make.Bullet <EternalFlame_AmmoType>(duck.position, owner, -180 + Rando.Float(-5, 5), this);
                 b.scale = new Vec2(2, 2);
                 firedBullets.Add(b);
                 Level.Add(b);
                 cooldown3 = -10;
             }
         }
         else
         {
             for (int i = 0; i < 10; i++)
             {
                 Bullet b = Make.Bullet <EternalFlame_AmmoType>(duck.position, owner, 0 + Rando.Float(-5, 5), this);
                 firedBullets.Add(b);
                 Level.Add(b);
                 cooldown3 = -10;
             }
         }
     }
 }
Esempio n. 2
0
        public override void Removed()
        {
            base.Removed();
            ExplosionPart ins = new(travelEnd.x, travelEnd.y, true);

            Level.Add(ins);
            SFX.Play("explode", 0.7f, Rando.Float(-0.7f, -0.5f), 0f, false);
            Thing bulletOwner = owner;
            IEnumerable <MaterialThing> things = Level.CheckCircleAll <MaterialThing>(travelEnd, 16f);

            foreach (MaterialThing t2 in things)
            {
                if (t2 != bulletOwner && t2.owner != bulletOwner)
                {
                    t2.Destroy(new DTShot(this));
                }
            }
            var firedBullets = new List <Bullet>(7);

            for (int i = 0; i < 7; i++)
            {
                var bullet = Make.Bullet <AT_Lava>(travelEnd, _owner, Rando.Float(0, 360), this);
                firedBullets.Add(bullet);
                Level.Add(bullet);
            }
            if (Network.isActive)
            {
                NMFireGun gunEvent = new(null, firedBullets, (byte)firedBullets.Count, rel : false, 4);
                Send.Message(gunEvent, NetMessagePriority.ReliableOrdered);
                firedBullets.Clear();
            }
            SFX.Play("sizzle", 0.2f, Rando.Float(1, 4), 0f, false);
        }
 public override void Removed()
 {
     NetHelper.NmFireGun(null, list =>
     {
         var bullet = Make.Bullet <AT_Leaf>(travelEnd, _owner, Rando.Float(0f, 360f), this);
         list.Add(bullet);
     });
     base.Removed();
 }
        public override void OnCollide(Vec2 pos, Thing t, bool willBeStopped)
        {
            for (int repeat = 0; repeat < 6; repeat++)
            {
                ExplosionPart ins = new(pos.x - 8f + Rando.Float(32f), pos.y - 8f + Rando.Float(32f))
                {
                    xscale = 3f,
                    yscale = 3f
                };
                Level.Add(ins);
            }
            SFX.Play("explode");
            Vec2 bPos = pos;

            bPos -= travelDirNormalized;

            NetHelper.NmFireGun(null, list =>
            {
                for (int i = 0; i < 24; i++)
                {
                    float dir     = (i * 30f) - 10f + Rando.Float(20f);
                    Bullet bullet = Make.Bullet <ATGrenadeLauncherShrapnel>(bPos, owner, dir, this);
                    list.Add(bullet);
                }
            });
            IEnumerable <Window> windows = Level.CheckCircleAll <Window>(position, 20f);

            foreach (Window w in windows)
            {
                if (Level.CheckLine <Block>(position, w.position, w) == null)
                {
                    w.Destroy(new DTImpact(this));
                }
            }
        }
    }