Esempio n. 1
0
 public override void OnSoftImpact(MaterialThing with, ImpactedFrom from)
 {
     if (this._fade || with is Gun || (with is AutoPlatform || with is Nubber) && (double)this.vSpeed <= 0.0)
     {
         return;
     }
     if (with is PhysicsObject)
     {
         this._isVolatile = -1f;
     }
     if ((double)this._startWait <= 0.0 && !this._fade && ((double)this.totalImpactPower > 2.0 && ((double)this._isVolatile <= 0.0 || !(with is Block)) || this._blowUp))
     {
         int num1 = 0;
         for (int index = 0; index < 1; ++index)
         {
             ExplosionPart explosionPart = new ExplosionPart(this.x - 8f + Rando.Float(16f), this.y - 8f + Rando.Float(16f));
             explosionPart.xscale *= 0.7f;
             explosionPart.yscale *= 0.7f;
             Level.Add((Thing)explosionPart);
             ++num1;
         }
         SFX.Play("explode");
         for (int index = 0; index < 12; ++index)
         {
             float      num2       = (float)((double)index * 30.0 - 10.0) + Rando.Float(20f);
             ATShrapnel atShrapnel = new ATShrapnel();
             atShrapnel.range = 25f + Rando.Float(10f);
             Level.Add((Thing) new Bullet(this.x + (float)(Math.Cos((double)Maths.DegToRad(num2)) * 8.0), this.y - (float)(Math.Sin((double)Maths.DegToRad(num2)) * 8.0), (AmmoType)atShrapnel, num2)
             {
                 firedFrom = (Thing)this
             });
         }
         this._fade = true;
         this.y    += 10000f;
     }
     else
     {
         if (with is IPlatform)
         {
             return;
         }
         if (from == ImpactedFrom.Left || from == ImpactedFrom.Right)
         {
             this.BounceH();
         }
         if (from != ImpactedFrom.Top && from != ImpactedFrom.Bottom)
         {
             return;
         }
         this.BounceV();
     }
 }
Esempio n. 2
0
        protected override void OnHit(bool destroyed)
        {
            if (!destroyed || !this.isLocal)
            {
                return;
            }
            for (int index = 0; index < 1; ++index)
            {
                ExplosionPart explosionPart = new ExplosionPart(this.x - 8f + Rando.Float(16f), this.y - 8f + Rando.Float(16f));
                explosionPart.xscale *= 0.7f;
                explosionPart.yscale *= 0.7f;
                Level.Add((Thing)explosionPart);
            }
            SFX.Play("explode");
            List <Bullet> varBullets = new List <Bullet>();
            Vec2          vec2       = this.position - this.travelDirNormalized;

            for (int index = 0; index < 12; ++index)
            {
                float ang = (float)((double)index * 30.0 - 10.0) + Rando.Float(20f);
                ATGrenadeLauncherShrapnel launcherShrapnel = new ATGrenadeLauncherShrapnel();
                launcherShrapnel.range = 25f + Rando.Float(10f);
                Bullet bullet = new Bullet(vec2.x, vec2.y, (AmmoType)launcherShrapnel, ang);
                bullet.firedFrom = (Thing)this;
                varBullets.Add(bullet);
                Level.Add((Thing)bullet);
            }
            if (Network.isActive && this.isLocal)
            {
                Send.Message((NetMessage) new NMFireGun((Gun)null, varBullets, (byte)0, false), NetMessagePriority.ReliableOrdered);
                varBullets.Clear();
            }
            foreach (Window window in Level.CheckCircleAll <Window>(this.position, 20f))
            {
                if (Level.CheckLine <Block>(this.position, window.position, (Thing)window) == null)
                {
                    window.Destroy((DestroyType) new DTImpact((Thing)this));
                }
            }
        }
Esempio n. 3
0
        protected override void OnHit(bool destroyed)
        {
            if (!destroyed)
            {
                return;
            }
            ExplosionPart explosionPart = new ExplosionPart(this.x, this.y);

            explosionPart.xscale *= 0.7f;
            explosionPart.yscale *= 0.7f;
            Level.Add((Thing)explosionPart);
            SFX.Play("magPop", 0.7f, Rando.Float(-0.5f, -0.3f));
            Thing owner = this.owner;

            foreach (MaterialThing materialThing in Level.CheckCircleAll <MaterialThing>(this.position, 14f))
            {
                if (materialThing != owner)
                {
                    materialThing.Destroy((DestroyType) new DTShot((Bullet)this));
                }
            }
        }