Exemplo n.º 1
0
 public override void Update()
 {
     base.Update();
     this._life        = 1f;
     this.angleDegrees = this._spinAngle;
     if ((bool)this._sparkTimer)
     {
         Level.Add((Thing)Spark.New(this.x, this.y - 2f, new Vec2(Rando.Float(-1f, 1f), -0.5f), 0.1f));
     }
     if (!(bool)this._explodeTimer)
     {
         return;
     }
     SFX.Play("littleGun", Rando.Float(0.8f, 1f), Rando.Float(-0.5f, 0.5f));
     for (int index = 0; index < 8; ++index)
     {
         float      num        = (float)((double)index * 45.0 - 5.0) + Rando.Float(10f);
         ATShrapnel atShrapnel = new ATShrapnel();
         atShrapnel.range = 8f + Rando.Float(3f);
         Level.Add((Thing) new Bullet(this.x + (float)(Math.Cos((double)Maths.DegToRad(num)) * 6.0), this.y - (float)(Math.Sin((double)Maths.DegToRad(num)) * 6.0), (AmmoType)atShrapnel, num)
         {
             firedFrom = (Thing)this
         });
     }
     Level.Add((Thing)SmallSmoke.New(this.x, this.y));
     if ((double)Rando.Float(1f) < 0.100000001490116)
     {
         Level.Add((Thing)SmallFire.New(this.x, this.y, 0.0f, 0.0f, firedFrom: ((Thing)this)));
     }
     Level.Remove((Thing)this);
 }
Exemplo n.º 2
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();
     }
 }
Exemplo n.º 3
0
        public void BlowUp()
        {
            if (this.blownUp)
            {
                return;
            }
            this.MakeBlowUpHappen(this.position);
            this.blownUp = true;
            foreach (PhysicsObject physicsObject in Level.CheckCircleAll <PhysicsObject>(this.position, 22f))
            {
                if (physicsObject != this)
                {
                    Vec2  vec2 = physicsObject.position - this.position;
                    float num1 = (float)(1.0 - (double)Math.Min(vec2.length, 22f) / 22.0);
                    float num2 = num1 * 4f;
                    vec2.Normalize();
                    physicsObject.hSpeed  += num2 * vec2.x;
                    physicsObject.vSpeed  += -5f * num1;
                    physicsObject.sleeping = false;
                    this.Fondle((Thing)physicsObject);
                }
            }
            float x = this.position.x;
            float y = this.position.y;

            for (int index = 0; index < 20; ++index)
            {
                float      ang        = (float)((double)index * 18.0 - 5.0) + Rando.Float(10f);
                ATShrapnel atShrapnel = new ATShrapnel();
                atShrapnel.range = 60f + Rando.Float(18f);
                Bullet bullet = new Bullet(x, y, (AmmoType)atShrapnel, ang);
                bullet.firedFrom = (Thing)this;
                this.firedBullets.Add(bullet);
                Level.Add((Thing)bullet);
            }
            this.bulletFireIndex += (byte)20;
            if (Network.isActive && this.isServerForObject)
            {
                Send.Message((NetMessage) new NMFireGun((Gun)this, this.firedBullets, this.bulletFireIndex, false), NetMessagePriority.ReliableOrdered);
                this.firedBullets.Clear();
            }
            if (Recorder.currentRecording != null)
            {
                Recorder.currentRecording.LogBonus();
            }
            Level.Remove((Thing)this);
        }
Exemplo n.º 4
0
 public override void Update()
 {
     base.Update();
     if (!this._pin)
     {
         this._timer -= 0.01f;
     }
     if ((double)this._timer < 0.5 && this.owner == null && !this._didBonus)
     {
         this._didBonus = true;
         if (Recorder.currentRecording != null)
         {
             Recorder.currentRecording.LogBonus();
         }
     }
     if (!this._localDidExplode && (double)this._timer < 0.0)
     {
         if (this._explodeFrames < 0)
         {
             this.CreateExplosion(this.position);
             this._explodeFrames = 4;
         }
         else
         {
             --this._explodeFrames;
             if (this._explodeFrames == 0)
             {
                 float x    = this.x;
                 float num1 = this.y - 2f;
                 Graphics.FlashScreen();
                 if (this.isServerForObject)
                 {
                     for (int index = 0; index < 20; ++index)
                     {
                         float      num2       = (float)((double)index * 18.0 - 5.0) + Rando.Float(10f);
                         ATShrapnel atShrapnel = new ATShrapnel();
                         atShrapnel.range = 60f + Rando.Float(18f);
                         Bullet bullet = new Bullet(x + (float)(Math.Cos((double)Maths.DegToRad(num2)) * 6.0), num1 - (float)(Math.Sin((double)Maths.DegToRad(num2)) * 6.0), (AmmoType)atShrapnel, num2);
                         bullet.firedFrom = (Thing)this;
                         this.firedBullets.Add(bullet);
                         Level.Add((Thing)bullet);
                     }
                     foreach (Window window in Level.CheckCircleAll <Window>(this.position, 40f))
                     {
                         if (Level.CheckLine <Block>(this.position, window.position, (Thing)window) == null)
                         {
                             window.Destroy((DestroyType) new DTImpact((Thing)this));
                         }
                     }
                     this.bulletFireIndex += (byte)20;
                     if (Network.isActive)
                     {
                         Send.Message((NetMessage) new NMFireGun((Gun)this, this.firedBullets, this.bulletFireIndex, false), NetMessagePriority.ReliableOrdered);
                         this.firedBullets.Clear();
                     }
                 }
                 Level.Remove((Thing)this);
                 this._destroyed     = true;
                 this._explodeFrames = -1;
             }
         }
     }
     if (this.prevOwner != null && this._cookThrower == null)
     {
         this._cookThrower     = this.prevOwner as Duck;
         this._cookTimeOnThrow = this._timer;
     }
     this._sprite.frame = this._pin ? 0 : 1;
 }