示例#1
0
 public override void Update()
 {
     if (this._switchFrames > 0)
     {
         --this._switchFrames;
     }
     if (this._ruined)
     {
         if (this._cape != null)
         {
             Level.Remove((Thing)this._cape);
             this._cape = (Cape)null;
         }
         this.graphic = this._damaged;
         if ((double)this._ghostWait > 0.0)
         {
             this._ghostWait -= 0.4f;
         }
         else
         {
             if (!this._madeGhost)
             {
                 Level.Add((Thing) new EscapingGhost(this.x, this.y - 6f));
                 for (int index = 0; index < 8; ++index)
                 {
                     Level.Add((Thing)Spark.New(this.x + Rando.Float(-8f, 8f), this.y + Rando.Float(-8f, 8f), new Vec2(Rando.Float(-1f, 1f), Rando.Float(-1f, 1f))));
                 }
             }
             this._madeGhost = true;
         }
     }
     base.Update();
 }
示例#2
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);
 }
示例#3
0
 public override void OnSoftImpact(MaterialThing with, ImpactedFrom from)
 {
     if (!(with is IPlatform))
     {
         return;
     }
     for (int index = 0; index < 4; ++index)
     {
         Level.Add((Thing)Spark.New(this.barrelPosition.x + Rando.Float(-6f, 6f), this.barrelPosition.y + Rando.Float(-3f, 3f), -MaterialThing.ImpactVector(from)));
     }
 }
示例#4
0
 // Token: 0x06002307 RID: 8967
 public void Shing(Thing wall)
 {
     if (!this._shing)
     {
         this._struggling = true;
         this._shing      = true;
         if (!Chainsaw._playedShing)
         {
             Chainsaw._playedShing = true;
             SFX.Play("chainsawClash", Rando.Float(0.4f, 0.55f), Rando.Float(-0.2f, 0.2f), Rando.Float(-0.1f, 0.1f), false);
         }
         Vec2 normalized = (this.position - base.barrelPosition).normalized;
         Vec2 value      = base.barrelPosition;
         for (int i = 0; i < 6; i++)
         {
             Level.Add(Spark.New(value.x, value.y, new Vec2(Rando.Float(-1f, 1f), Rando.Float(-1f, 1f)), 0.02f));
             value += normalized * 4f;
         }
         this._swordSwing.speed = 0f;
         if (Recorder.currentRecording != null)
         {
             Recorder.currentRecording.LogAction(7);
         }
         if (base.duck != null)
         {
             Duck duck = base.duck;
             if (wall.bottom < duck.top)
             {
                 duck.vSpeed += 2f;
                 return;
             }
             if (duck.sliding)
             {
                 duck.sliding = false;
             }
             if (wall.x > duck.x)
             {
                 duck.hSpeed -= 5f;
             }
             else
             {
                 duck.hSpeed += 5f;
             }
             duck.vSpeed -= 2f;
         }
     }
 }
        public override void Update()
        {
            PhysicsObject physicsObject = this._attach;

            if (this._attach is Duck)
            {
                Duck attach = this._attach as Duck;
                physicsObject = attach.ragdoll != null ? (PhysicsObject)attach.ragdoll.part1 : (PhysicsObject)attach;
            }
            if (physicsObject == null)
            {
                return;
            }
            double        num1 = (double)this.Solve((PhysicsObject)this, physicsObject, 30f);
            int           num2 = 0;
            PhysicsObject b2   = (PhysicsObject)this;

            foreach (ChainLink link in this._links)
            {
                double num3 = (double)this.Solve((PhysicsObject)link, b2, 2f);
                b2         = (PhysicsObject)link;
                link.depth = this._attach.depth - 8 - num2;
                ++num2;
            }
            double num4 = (double)this.Solve(physicsObject, b2, 2f);

            base.Update();
            if ((double)this._sparkWait > 0.0)
            {
                this._sparkWait -= 0.1f;
            }
            else
            {
                this._sparkWait = 0.0f;
            }
            if ((double)this._sparkWait != 0.0 || !this.grounded || (double)Math.Abs(this.hSpeed) <= 1.0)
            {
                return;
            }
            this._sparkWait = 0.25f;
            Level.Add((Thing)Spark.New(this.x + ((double)this.hSpeed > 0.0 ? -2f : 2f), this.y + 7f, new Vec2(0.0f, 0.5f)));
        }
示例#6
0
 // Token: 0x06000CC6 RID: 3270
 public void Shing()
 {
     if (!this._shing)
     {
         this._pullBack   = false;
         this._swinging   = false;
         this._shing      = true;
         this._swingPress = false;
         if (!Sword._playedShing)
         {
             Sword._playedShing = true;
             SFX.Play("swordClash", Rando.Float(0.6f, 0.7f), Rando.Float(-0.1f, 0.1f), Rando.Float(-0.1f, 0.1f), false);
         }
         Vec2 vec   = (this.position - base.barrelPosition).normalized;
         Vec2 start = base.barrelPosition;
         for (int i = 0; i < 6; i++)
         {
             Level.Add(Spark.New(start.x, start.y, new Vec2(Rando.Float(-1f, 1f), Rando.Float(-1f, 1f)), 0.02f));
             start += vec * 4f;
         }
         this._swung            = false;
         this._swordSwing.speed = 0f;
     }
 }
        public override void OnHit(bool destroyed, Bullet b)
        {
            if (!b.isLocal)
            {
                return;
            }
            if (destroyed)
            {
                new ATMissileShrapnel().MakeNetEffect(b.position, false);
                Random random = (Random)null;
                if (Network.isActive && b.isLocal)
                {
                    random          = Rando.generator;
                    Rando.generator = new Random(NetRand.currentSeed);
                }
                List <Bullet> varBullets = new List <Bullet>();
                for (int index = 0; index < 12; ++index)
                {
                    float             num = (float)((double)index * 30.0 - 10.0) + Rando.Float(20f);
                    ATMissileShrapnel atMissileShrapnel = new ATMissileShrapnel();
                    atMissileShrapnel.range = 15f + Rando.Float(5f);
                    Vec2   vec2   = new Vec2((float)Math.Cos((double)Maths.DegToRad(num)), (float)Math.Sin((double)Maths.DegToRad(num)));
                    Bullet bullet = new Bullet(b.x + vec2.x * 8f, b.y - vec2.y * 8f, (AmmoType)atMissileShrapnel, num);
                    bullet.firedFrom = (Thing)b;
                    varBullets.Add(bullet);
                    Level.Add((Thing)bullet);
                    Level.Add((Thing)Spark.New(b.x + Rando.Float(-8f, 8f), b.y + Rando.Float(-8f, 8f), vec2 + new Vec2(Rando.Float(-0.1f, 0.1f), Rando.Float(-0.1f, 0.1f))));
                    Level.Add((Thing)SmallSmoke.New(b.x + vec2.x * 8f + Rando.Float(-8f, 8f), b.y + vec2.y * 8f + Rando.Float(-8f, 8f)));
                }
                if (Network.isActive && b.isLocal)
                {
                    Send.Message((NetMessage) new NMFireGun((Gun)null, varBullets, (byte)0, false), NetMessagePriority.ReliableOrdered);
                    varBullets.Clear();
                }
                if (Network.isActive && b.isLocal)
                {
                    Rando.generator = random;
                }
                foreach (Window window in Level.CheckCircleAll <Window>(b.position, 30f))
                {
                    if (b.isLocal)
                    {
                        Thing.Fondle((Thing)window, DuckNetwork.localConnection);
                    }
                    if (Level.CheckLine <Block>(b.position, window.position, (Thing)window) == null)
                    {
                        window.Destroy((DestroyType) new DTImpact((Thing)b));
                    }
                }
                foreach (PhysicsObject physicsObject in Level.CheckCircleAll <PhysicsObject>(b.position, 70f))
                {
                    if (b.isLocal && b.owner == null)
                    {
                        Thing.Fondle((Thing)physicsObject, DuckNetwork.localConnection);
                    }
                    if ((double)(physicsObject.position - b.position).length < 30.0)
                    {
                        physicsObject.Destroy((DestroyType) new DTImpact((Thing)b));
                    }
                    physicsObject.sleeping = false;
                    physicsObject.vSpeed   = -2f;
                }
                HashSet <ushort> varBlocks = new HashSet <ushort>();
                foreach (BlockGroup blockGroup1 in Level.CheckCircleAll <BlockGroup>(b.position, 50f))
                {
                    if (blockGroup1 != null)
                    {
                        BlockGroup   blockGroup2 = blockGroup1;
                        List <Block> blockList   = new List <Block>();
                        foreach (Block block in blockGroup2.blocks)
                        {
                            if (Collision.Circle(b.position, 28f, block.rectangle))
                            {
                                block.shouldWreck = true;
                                if (block is AutoBlock)
                                {
                                    varBlocks.Add((block as AutoBlock).blockIndex);
                                }
                            }
                        }
                        blockGroup2.Wreck();
                    }
                }
                foreach (Block block in Level.CheckCircleAll <Block>(b.position, 28f))
                {
                    switch (block)
                    {
                    case AutoBlock _:
                        block.skipWreck   = true;
                        block.shouldWreck = true;
                        if (block is AutoBlock)
                        {
                            varBlocks.Add((block as AutoBlock).blockIndex);
                            continue;
                        }
                        continue;

                    case Door _:
                    case VerticalDoor _:
                        Level.Remove((Thing)block);
                        block.Destroy((DestroyType) new DTRocketExplosion((Thing)null));
                        continue;

                    default:
                        continue;
                    }
                }
                if (Network.isActive && b.isLocal && varBlocks.Count > 0)
                {
                    Send.Message((NetMessage) new NMDestroyBlocks(varBlocks));
                }
            }
            base.OnHit(destroyed, b);
        }
示例#8
0
        public override void Update()
        {
            if (this._lastOwner != null && this.owner == null)
            {
                this._lastOwner.frictionMod = 0.0f;
                this._lastOwner             = (PhysicsObject)null;
            }
            this.collisionOffset = new Vec2(-2f, 0.0f);
            this.collisionSize   = new Vec2(4f, 18f);
            if ((double)this._swing > 0.0)
            {
                this.collisionOffset = new Vec2(-9999f, 0.0f);
                this.collisionSize   = new Vec2(4f, 18f);
            }
            this._swingVelocity = Maths.LerpTowards(this._swingVelocity, this._swingForce, 0.1f);
            Duck owner = this.owner as Duck;

            if (this.isServerForObject)
            {
                this._swing += this._swingVelocity;
                float num1 = this._swing - this._swingLast;
                this._swingLast = this._swing;
                if ((double)this._swing > 1.0)
                {
                    this._swing = 1f;
                }
                if ((double)this._swing < 0.0)
                {
                    this._swing = 0.0f;
                }
                this._sprite.flipH = false;
                this._sprite.flipV = false;
                if ((double)this._sparkWait > 0.0)
                {
                    this._sparkWait -= 0.1f;
                }
                else
                {
                    this._sparkWait = 0.0f;
                }
                if (owner != null)
                {
                    if ((double)this._sparkWait == 0.0 && (double)this._swing == 0.0)
                    {
                        if (owner.grounded && owner.offDir > (sbyte)0 && (double)owner.hSpeed > 1.0)
                        {
                            this._sparkWait = 0.25f;
                            Level.Add((Thing)Spark.New(this.x - 22f, this.y + 6f, new Vec2(0.0f, 0.5f)));
                        }
                        else if (owner.grounded && owner.offDir < (sbyte)0 && (double)owner.hSpeed < -1.0)
                        {
                            this._sparkWait = 0.25f;
                            Level.Add((Thing)Spark.New(this.x + 22f, this.y + 6f, new Vec2(0.0f, 0.5f)));
                        }
                    }
                    float hSpeed = owner.hSpeed;
                    this._hPull = Maths.LerpTowards(this._hPull, owner.hSpeed, 0.15f);
                    if ((double)Math.Abs(owner.hSpeed) < 0.100000001490116)
                    {
                        this._hPull = 0.0f;
                    }
                    float num2 = Math.Abs(this._hPull) / 2.5f;
                    if ((double)num2 > 1.0)
                    {
                        num2 = 1f;
                    }
                    this.weight = (float)(8.0 - (double)num2 * 3.0);
                    if ((double)this.weight <= 5.0)
                    {
                        this.weight = 5.1f;
                    }
                    float num3 = Math.Abs(owner.hSpeed - this._hPull);
                    owner.frictionMod = 0.0f;
                    if ((double)owner.hSpeed > 0.0 && (double)this._hPull > (double)owner.hSpeed)
                    {
                        owner.frictionMod = (float)(-(double)num3 * 1.79999995231628);
                    }
                    if ((double)owner.hSpeed < 0.0 && (double)this._hPull < (double)owner.hSpeed)
                    {
                        owner.frictionMod = (float)(-(double)num3 * 1.79999995231628);
                    }
                    this._lastDir   = (int)owner.offDir;
                    this._lastSpeed = hSpeed;
                    if ((double)this._swing != 0.0 && (double)num1 > 0.0)
                    {
                        owner.hSpeed += (float)owner.offDir * (num1 * 3f) * this.weightMultiplier;
                        owner.vSpeed -= num1 * 2f * this.weightMultiplier;
                    }
                }
            }
            if ((double)this._swing < 0.5)
            {
                float num = this._swing * 2f;
                this._sprite.imageIndex = (int)((double)num * 10.0);
                this._sprite.angle      = (float)(1.20000004768372 - (double)num * 1.5);
                this._sprite.yscale     = (float)(1.0 - (double)num * 0.100000001490116);
            }
            else if ((double)this._swing >= 0.5)
            {
                float num = (float)(((double)this._swing - 0.5) * 2.0);
                this._sprite.imageIndex = 10 - (int)((double)num * 10.0);
                this._sprite.angle      = (float)(-0.300000011920929 - (double)num * 1.5);
                this._sprite.yscale     = (float)(1.0 - (1.0 - (double)num) * 0.100000001490116);
                this._fullSwing        += 0.16f;
                if (!this._swung)
                {
                    this._swung = true;
                    if (this.duck != null && this.isServerForObject)
                    {
                        Level.Add((Thing) new ForceWave(this.x + (float)this.offDir * 4f + this.owner.hSpeed, this.y + 8f, (int)this.offDir, 0.15f, 4f + Math.Abs(this.owner.hSpeed), this.owner.vSpeed, this.duck));
                    }
                }
            }
            if ((double)this._swing == 1.0)
            {
                this._pressed = false;
            }
            if ((double)this._swing == 1.0 && !this._pressed && (double)this._fullSwing > 1.0)
            {
                this._swingForce = -0.08f;
                this._fullSwing  = 0.0f;
            }
            if (this._sledgeSwing.finished)
            {
                this._sledgeSwing.speed = 0.0f;
            }
            this._lastOwner = this.owner as PhysicsObject;
            if (this.duck != null)
            {
                if (this.duck.action && !this._held && (double)this._swing == 0.0)
                {
                    this._fullSwing         = 0.0f;
                    owner._disarmDisable    = 30;
                    owner.crippleTimer      = 1f;
                    this._sledgeSwing.speed = 1f;
                    this._sledgeSwing.frame = 0;
                    this._swingForce        = 0.6f;
                    this._pressed           = true;
                    this._swung             = false;
                    this._held = true;
                }
                if (!this.duck.action)
                {
                    this._pressed = false;
                    this._held    = false;
                }
            }
            base.Update();
        }
示例#9
0
        public override void Update()
        {
            this._waveMult = Lerp.Float(this._waveMult, 0.0f, 0.1f);
            if (this.isServerForObject)
            {
                this._magnetActive = this.action;
            }
            else if (this._magnetActive)
            {
                this._waveMult = 1f;
            }
            if ((double)this._beamSound.Volume > 0.00999999977648258 && this._beamSound.State != SoundState.Playing)
            {
                this._beamSound.Play();
            }
            else if ((double)this._beamSound.Volume < 0.00999999977648258 && this._beamSound.State == SoundState.Playing)
            {
                this._beamSound.Stop();
            }
            this._beamSound.Volume = Maths.LerpTowards(this._beamSound.Volume, this._magnetActive ? 0.1f : 0.0f, 0.1f);
            Vec2 p1_1 = this.Offset(this.barrelOffset);

            if (this._magnetActive && this.duck != null && this.duck.holdObject == this)
            {
                foreach (MagnaLine line in this._lines)
                {
                    line.Update();
                    line.show = true;
                    float num = this._ammoType.range;
                    if (this._hasRay)
                    {
                        num = (this.barrelPosition - this._rayHit).length;
                    }
                    line.dist = num;
                }
                if (this._grabbed == null && this._stuck == null)
                {
                    Holdable holdable1   = (Holdable)null;
                    float    val1        = 0.0f;
                    Vec2     normalized1 = this.barrelVector.Rotate(Maths.DegToRad(90f), Vec2.Zero).normalized;
                    for (int index = 0; index < 3; ++index)
                    {
                        Vec2 p1_2 = p1_1;
                        if (index == 0)
                        {
                            p1_2 += normalized1 * 8f;
                        }
                        else if (index == 2)
                        {
                            p1_2 -= normalized1 * 8f;
                        }
                        foreach (Holdable holdable2 in Level.CheckLineAll <Holdable>(p1_2, p1_2 + this.barrelVector * this._ammoType.range))
                        {
                            if (holdable2 != this && holdable2 != this.owner && (holdable2.owner != this.owner && holdable2.physicsMaterial == PhysicsMaterial.Metal) && (holdable2.duck == null || !(holdable2.duck.holdObject is MagnetGun)))
                            {
                                float length = (holdable2.position - p1_1).length;
                                if (holdable1 == null || (double)length < (double)val1)
                                {
                                    val1      = length;
                                    holdable1 = holdable2;
                                }
                            }
                        }
                    }
                    this._hasRay = false;
                    if (holdable1 != null && Level.CheckLine <Block>(p1_1, holdable1.position) == null)
                    {
                        float num = (float)((1.0 - (double)Math.Min(val1, this._ammoType.range) / (double)this._ammoType.range) * 0.800000011920929);
                        if (holdable1.owner is Duck duck && !(duck.holdObject is MagnetGun) && (double)num > 0.300000011920929)
                        {
                            if (!(holdable1 is Equipment) || holdable1.equippedDuck == null)
                            {
                                duck.ThrowItem(false);
                                duck = (Duck)null;
                            }
                            else if (holdable1 is TinfoilHat)
                            {
                                duck.Unequip(holdable1 as Equipment);
                                duck = (Duck)null;
                            }
                        }
                        Vec2 normalized2 = (p1_1 - holdable1.position).normalized;
                        // TODO if (duck != null && holdable1 is Equipment)
                        if (false)
                        {
                            if (duck.ragdoll != null)
                            {
                                duck.ragdoll.makeActive = true;
                                return;
                            }
                            if (!(holdable1.owner.realObject is Duck) && Network.isActive)
                            {
                                return;
                            }
                            holdable1.owner.realObject.hSpeed += normalized2.x * num;
                            holdable1.owner.realObject.vSpeed += (float)((double)normalized2.y * (double)num * 4.0);
                            if ((holdable1.owner.realObject as PhysicsObject).grounded && (double)holdable1.owner.realObject.vSpeed > 0.0)
                            {
                                holdable1.owner.realObject.vSpeed = 0.0f;
                            }
                        }
                        else
                        {
                            this.Fondle((Thing)holdable1);
                            holdable1.hSpeed += normalized2.x * num;
                            holdable1.vSpeed += (float)((double)normalized2.y * (double)num * 4.0);
                            if (holdable1.grounded && (double)holdable1.vSpeed > 0.0)
                            {
                                holdable1.vSpeed = 0.0f;
                            }
                        }
                        this._hasRay = true;
                        this._rayHit = holdable1.position;
                        if (this.isServerForObject && (double)val1 < 20.0)
                        {
                            if (holdable1 is Equipment && holdable1.duck != null)
                            {
                                this._grabbed = holdable1.owner.realObject;
                                holdable1.duck.immobilized = true;
                                holdable1.duck.gripped     = true;
                                holdable1.duck.ThrowItem();
                                if (!(holdable1.owner.realObject is Duck))
                                {
                                    holdable1.owner.realObject.owner = this.owner;
                                    Thing.SuperFondle(holdable1.owner.realObject, DuckNetwork.localConnection);
                                }
                            }
                            else
                            {
                                this._grabbed   = (Thing)holdable1;
                                holdable1.owner = this.owner;
                                if (holdable1 is Grenade)
                                {
                                    (holdable1 as Grenade).OnPressAction();
                                }
                            }
                            this.attachIndex += 1;
                        }
                    }
                    else if (this.isServerForObject && this._stuck == null && ((double)Math.Abs(this.angle) < 0.0500000007450581 || (double)Math.Abs(this.angle) > 1.5))
                    {
                        Vec2 position = this.owner.position;
                        if (this.duck.sliding)
                        {
                            position.y += 4f;
                        }
                        Vec2  hitPos;
                        Block block = Level.CheckRay <Block>(position, position + this.barrelVector * this._ammoType.range, out hitPos);
                        this._hasRay = true;
                        this._rayHit = hitPos;
                        if (block != null && block.physicsMaterial == PhysicsMaterial.Metal)
                        {
                            float num    = (float)((1.0 - (double)Math.Min((block.position - position).length, this._ammoType.range) / (double)this._ammoType.range) * 0.800000011920929);
                            Vec2  vec2   = hitPos - this.duck.position;
                            float length = vec2.length;
                            vec2.Normalize();
                            this.owner.hSpeed += vec2.x * num;
                            this.owner.vSpeed += vec2.y * num;
                            if ((double)length < 20.0)
                            {
                                this._stuck       = block;
                                this._stickPos    = hitPos;
                                this._stickNormal = -this.barrelVector;
                                this.attachIndex += 1;
                            }
                        }
                    }
                }
            }
            else
            {
                if (this.isServerForObject)
                {
                    if (this._grabbed != null)
                    {
                        this._grabbed.angle = 0.0f;
                        if (this._grabbed is Holdable grabbed)
                        {
                            grabbed.owner = (Thing)null;
                            grabbed.ReturnToWorld();
                            this.ReturnItemToWorld((Thing)grabbed);
                        }
                        if (this._grabbed is Duck grabbed2)
                        {
                            grabbed2.immobilized  = false;
                            grabbed2.gripped      = false;
                            grabbed2.crippleTimer = 1f;
                        }
                        this._grabbed.visible       = true;
                        this._grabbed.enablePhysics = true;
                        this._grabbed.hSpeed        = this.barrelVector.x * 5f;
                        this._grabbed.vSpeed        = this.barrelVector.y * 5f;
                        this._grabbed       = (Thing)null;
                        this._collisionSize = new Vec2(14f, this._collisionSize.y);
                    }
                    if (this._stuck != null)
                    {
                        this._stuck = (Block)null;
                        if (this.owner != null && !this._raised)
                        {
                            this.duck._groundValid = 6;
                        }
                    }
                }
                foreach (MagnaLine line in this._lines)
                {
                    line.show = false;
                }
            }
            if (Network.isActive)
            {
                if (this._grabbed != null)
                {
                    if (this._grabbed is TrappedDuck && this._grabbed.connection != this.connection)
                    {
                        this._grabbed = (Thing)(this._grabbed as TrappedDuck)._duckOwner;
                        if (this._grabbed != null)
                        {
                            Duck grabbed2 = this._grabbed as Duck;
                            grabbed2.immobilized = true;
                            grabbed2.gripped     = true;
                            grabbed2.ThrowItem();
                            grabbed2._trapped = (TrappedDuck)null;
                        }
                    }
                    if (this._grabbed is Duck grabbed)
                    {
                        grabbed.isGrabbedByMagnet = true;
                        if (this.isServerForObject)
                        {
                            this.Fondle((Thing)grabbed);
                            this.Fondle((Thing)grabbed.holdObject);
                            foreach (Thing t in grabbed._equipment)
                            {
                                this.Fondle(t);
                            }
                            this.Fondle((Thing)grabbed._ragdollInstance);
                            this.Fondle((Thing)grabbed._trappedInstance);
                            this.Fondle((Thing)grabbed._cookedInstance);
                        }
                    }
                }
                if (this._grabbed == null && this._prevGrabDuck != null && this._prevGrabDuck is Duck)
                {
                    (this._prevGrabDuck as Duck).isGrabbedByMagnet = false;
                }
                this._prevGrabDuck = this._grabbed;
            }
            if (this._grabbed != null && this.owner != null)
            {
                if (this.isServerForObject)
                {
                    this.Fondle(this._grabbed);
                }
                this._grabbed.hSpeed        = this.owner.hSpeed;
                this._grabbed.vSpeed        = this.owner.vSpeed;
                this._grabbed.angle         = this.angle;
                this._grabbed.visible       = false;
                this._grabbed.offDir        = this.offDir;
                this._grabbed.enablePhysics = false;
                this._collisionSize         = new Vec2(16f + this._grabbed.width, this._collisionSize.y);
                if (this._grabbed is Duck grabbed)
                {
                    grabbed.grounded = true;
                    grabbed.sliding  = false;
                    grabbed.crouch   = false;
                }
                else
                {
                    this._grabbed.owner = (Thing)this;
                }
            }
            if (this.localAttachIndex < this.attachIndex)
            {
                for (int index = 0; index < 2; ++index)
                {
                    Level.Add((Thing)SmallSmoke.New(p1_1.x + Rando.Float(-1f, 1f), p1_1.y + Rando.Float(-1f, 1f)));
                }
                SFX.Play("grappleHook");
                for (int index = 0; index < 6; ++index)
                {
                    Level.Add((Thing)Spark.New(p1_1.x - this.barrelVector.x * 2f + Rando.Float(-1f, 1f), p1_1.y - this.barrelVector.y * 2f + Rando.Float(-1f, 1f), this.barrelVector + new Vec2(Rando.Float(-1f, 1f), Rando.Float(-1f, 1f))));
                }
                this.localAttachIndex = this.attachIndex;
            }
            if (this.isServerForObject)
            {
                if (this._magnetActive && this._raised && (this.duck != null && !this.duck.grounded) && this._grabbed == null)
                {
                    this._keepRaised = true;
                }
                else
                {
                    this._keepRaised = false;
                }
                if (this._stuck != null && this.duck != null)
                {
                    if ((double)this._stickPos.y < (double)this.owner.position.y - 8.0)
                    {
                        this.owner.position = this._stickPos + this._stickNormal * 12f;
                        this._raised        = true;
                        this._keepRaised    = true;
                    }
                    else
                    {
                        this.owner.position = this._stickPos + this._stickNormal * 16f;
                        this._raised        = false;
                        this._keepRaised    = false;
                    }
                    this.owner.hSpeed  = this.owner.vSpeed = 0.0f;
                    this.duck.moveLock = true;
                }
                else if (this._stuck == null && this.duck != null)
                {
                    this.duck.moveLock = false;
                }
                if (this.owner == null && this.prevOwner != null)
                {
                    if (this.prevOwner is Duck prevOwner)
                    {
                        prevOwner.moveLock = false;
                    }
                    this._prevOwner = (Thing)null;
                }
            }
            base.Update();
        }
示例#10
0
        // Token: 0x0600230C RID: 8972
        public override void Update()
        {
            base.Update();
            float num = 1f;

            if (this.souped)
            {
                num = 1.3f;
            }
            if (this._swordSwing.finished)
            {
                this._swordSwing.speed = 0f;
            }
            if (this._hitWait > 0)
            {
                this._hitWait--;
            }
            if (this._gas < 0.01f)
            {
                this.ammo = 0;
            }
            this._framesExisting++;
            if (this._framesExisting > 100)
            {
                this._framesExisting = 100;
            }
            float pitch = this.souped ? 0.3f : 0f;

            this._sound.lerpVolume = ((this._started && !this._throttle) ? 0.6f : 0f);
            this._sound.pitch      = pitch;
            if (this._started)
            {
                this._warmUp += 0.001f;
                if (this._warmUp > 1f)
                {
                    this._warmUp = 1f;
                }
                if (!this._puffClick && this._idleWave > 0.9f)
                {
                    this._skipSmoke = !this._skipSmoke;
                    if (this._throttle || !this._skipSmoke)
                    {
                        Level.Add(SmallSmoke.New(base.x + (float)(this.offDir * 4), base.y + 5f, this._smokeFlipper ? -0.1f : 0.8f, 0.7f));
                        this._smokeFlipper = !this._smokeFlipper;
                        this._puffClick    = true;
                    }
                }
                else if (this._puffClick && this._idleWave < 0f)
                {
                    this._puffClick = false;
                }
                if (this._pullState < 0)
                {
                    float num2 = 1f + Maths.NormalizeSection(this._engineSpin, 1f, 2f) * 2f;
                    float num3 = this._idleWave;
                    if (num2 > 1f)
                    {
                        num3 = this._spinWave;
                    }
                    this.handOffset  = Lerp.Vec2Smooth(this.handOffset, new Vec2(0f, 2f + num3 * num2), 0.23f);
                    this._holdOffset = Lerp.Vec2Smooth(this._holdOffset, new Vec2(1f, 2f + num3 * num2), 0.23f);
                    float num4 = Maths.NormalizeSection(this._engineSpin, 1f, 2f) * 3f;
                    this._rotSway = this._idleWave.normalized * num4 * 0.03f;
                }
                else
                {
                    this._rotSway = 0f;
                }
                this._gas -= 3E-05f;
                if (this._throttle)
                {
                    this._gas -= 0.0002f;
                }
                if (this._gas < 0f)
                {
                    this._gas      = 0f;
                    this._started  = false;
                    this._throttle = false;
                }
                if (this._triggerHeld)
                {
                    if (this._releasedSincePull)
                    {
                        if (!this._throttle)
                        {
                            this._throttle = true;
                            SFX.Play("chainsawBladeRevUp", 0.5f, pitch, 0f, false);
                        }
                        this._engineSpin = Lerp.FloatSmooth(this._engineSpin, 4f, 0.1f, 1f);
                    }
                }
                else
                {
                    if (this._throttle)
                    {
                        this._throttle = false;
                        if (this._engineSpin > 1.7f)
                        {
                            SFX.Play("chainsawBladeRevDown", 0.5f, pitch, 0f, false);
                        }
                    }
                    this._engineSpin        = Lerp.FloatSmooth(this._engineSpin, 0f, 0.1f, 1f);
                    this._releasedSincePull = true;
                }
            }
            else
            {
                this._warmUp -= 0.001f;
                if (this._warmUp < 0f)
                {
                    this._warmUp = 0f;
                }
                this._releasedSincePull = false;
                this._throttle          = false;
            }
            this._bladeSound.lerpSpeed  = 0.1f;
            this._throttleWait          = Lerp.Float(this._throttleWait, this._throttle ? 1f : 0f, 0.07f);
            this._bladeSound.lerpVolume = ((this._throttleWait > 0.96f) ? 0.6f : 0f);
            if (this._struggling)
            {
                this._bladeSound.lerpVolume = 0f;
            }
            this._bladeSoundLow.lerpVolume = ((this._throttleWait > 0.96f && this._struggling) ? 0.6f : 0f);
            this._bladeSound.pitch         = pitch;
            this._bladeSoundLow.pitch      = pitch;
            if (this.owner == null)
            {
                this.collisionOffset = new Vec2(-8f, -6f);
                this.collisionSize   = new Vec2(13f, 11f);
            }
            else if (base.duck != null && (base.duck.sliding || base.duck.crouch))
            {
                this.collisionOffset = new Vec2(-8f, -6f);
                this.collisionSize   = new Vec2(6f, 11f);
            }
            else
            {
                this.collisionOffset = new Vec2(-8f, -6f);
                this.collisionSize   = new Vec2(10f, 11f);
            }
            if (this.owner != null)
            {
                this._resetDuck = false;
                if (this._pullState == -1)
                {
                    if (!this._started)
                    {
                        this.handOffset  = Lerp.Vec2Smooth(this.handOffset, new Vec2(0f, 2f), 0.25f);
                        this._holdOffset = Lerp.Vec2Smooth(this._holdOffset, new Vec2(1f, 2f), 0.23f);
                    }
                    this._upWait = 0f;
                }
                else if (this._pullState == 0)
                {
                    this._animRot    = Lerp.FloatSmooth(this._animRot, -0.4f, 0.15f, 1f);
                    this.handOffset  = Lerp.Vec2Smooth(this.handOffset, new Vec2(-2f, -2f), 0.25f);
                    this._holdOffset = Lerp.Vec2Smooth(this._holdOffset, new Vec2(-4f, 4f), 0.23f);
                    if (this._animRot <= -0.35f)
                    {
                        this._animRot   = -0.4f;
                        this._pullState = 1;
                        this.PullEngine();
                    }
                    this._upWait = 0f;
                }
                else if (this._pullState == 1)
                {
                    this._releasePull = false;
                    this._holdOffset  = Lerp.Vec2Smooth(this._holdOffset, new Vec2(2f, 3f), 0.23f);
                    this.handOffset   = Lerp.Vec2Smooth(this.handOffset, new Vec2(-4f, -2f), 0.23f);
                    this._animRot     = Lerp.FloatSmooth(this._animRot, -0.5f, 0.07f, 1f);
                    if (this._animRot < -0.45f)
                    {
                        this._animRot   = -0.5f;
                        this._pullState = 2;
                    }
                    this._upWait = 0f;
                }
                else if (this._pullState == 2)
                {
                    if (this._releasePull || !this._triggerHeld)
                    {
                        this._releasePull = true;
                        if (this._started)
                        {
                            this.handOffset  = Lerp.Vec2Smooth(this.handOffset, new Vec2(0f, 2f + this._idleWave.normalized), 0.23f);
                            this._holdOffset = Lerp.Vec2Smooth(this._holdOffset, new Vec2(1f, 2f + this._idleWave.normalized), 0.23f);
                            this._animRot    = Lerp.FloatSmooth(this._animRot, 0f, 0.1f, 1f);
                            if (this._animRot > -0.07f)
                            {
                                this._animRot   = 0f;
                                this._pullState = -1;
                            }
                        }
                        else
                        {
                            this._holdOffset = Lerp.Vec2Smooth(this._holdOffset, new Vec2(-4f, 4f), 0.24f);
                            this.handOffset  = Lerp.Vec2Smooth(this.handOffset, new Vec2(-2f, -2f), 0.24f);
                            this._animRot    = Lerp.FloatSmooth(this._animRot, -0.4f, 0.12f, 1f);
                            if (this._animRot > -0.44f)
                            {
                                this._releasePull = false;
                                this._animRot     = -0.4f;
                                this._pullState   = 3;
                                this._holdOffset  = new Vec2(-4f, 4f);
                                this.handOffset   = new Vec2(-2f, -2f);
                            }
                        }
                    }
                    this._upWait = 0f;
                }
                else if (this._pullState == 3)
                {
                    this._releasePull = false;
                    this._upWait     += 0.1f;
                    if (this._upWait > 6f)
                    {
                        this._pullState = -1;
                    }
                }
                this._bladeSpin += this._engineSpin;
                while (this._bladeSpin >= 1f)
                {
                    this._bladeSpin -= 1f;
                    int num5 = this._sprite.frame + 1;
                    if (num5 > 15)
                    {
                        num5 = 0;
                    }
                    this._sprite.frame = num5;
                }
                this._engineSpin        = Lerp.FloatSmooth(this._engineSpin, 0f, 0.1f, 1f);
                this._engineResistance  = Lerp.FloatSmooth(this._engineResistance, 1f, 0.01f, 1f);
                this._hold              = -0.4f;
                this.center             = new Vec2(8f, 7f);
                this._framesSinceThrown = 0;
            }
            else
            {
                this._rotSway = 0f;
                this._shing   = false;
                this._animRot = Lerp.FloatSmooth(this._animRot, 0f, 0.18f, 1f);
                if (this._framesSinceThrown == 1)
                {
                    this._throwSpin = base.angleDegrees;
                }
                this._hold        = 0f;
                base.angleDegrees = this._throwSpin;
                this.center       = new Vec2(8f, 7f);
                bool flag  = false;
                bool flag2 = false;
                if ((Math.Abs(this.hSpeed) + Math.Abs(this.vSpeed) > 2f || !base.grounded) && this.gravMultiplier > 0f)
                {
                    if (!base.grounded && Level.CheckRect <Block>(this.position + new Vec2(-8f, -6f), this.position + new Vec2(8f, -2f), null) != null)
                    {
                        flag2 = true;
                    }
                    if (!flag2 && !this._grounded && Level.CheckPoint <IPlatform>(this.position + new Vec2(0f, 8f), null, null) == null)
                    {
                        if (this.offDir > 0)
                        {
                            this._throwSpin += (Math.Abs(this.hSpeed) + Math.Abs(this.vSpeed)) * 1f + 5f;
                        }
                        else
                        {
                            this._throwSpin -= (Math.Abs(this.hSpeed) + Math.Abs(this.vSpeed)) * 1f + 5f;
                        }
                        flag = true;
                    }
                }
                if (!flag || flag2)
                {
                    this._throwSpin %= 360f;
                    if (this._throwSpin < 0f)
                    {
                        this._throwSpin += 360f;
                    }
                    if (flag2)
                    {
                        if (Math.Abs(this._throwSpin - 90f) < Math.Abs(this._throwSpin + 90f))
                        {
                            this._throwSpin = Lerp.Float(this._throwSpin, 90f, 16f);
                        }
                        else
                        {
                            this._throwSpin = Lerp.Float(-90f, 0f, 16f);
                        }
                    }
                    else if (this._throwSpin > 90f && this._throwSpin < 270f)
                    {
                        this._throwSpin = Lerp.Float(this._throwSpin, 180f, 14f);
                    }
                    else
                    {
                        if (this._throwSpin > 180f)
                        {
                            this._throwSpin -= 360f;
                        }
                        else if (this._throwSpin < -180f)
                        {
                            this._throwSpin += 360f;
                        }
                        this._throwSpin = Lerp.Float(this._throwSpin, 0f, 14f);
                    }
                }
            }
            if (Math.Abs(this._angle) > 1f)
            {
                this._flood += 0.005f;
                if (this._flood > 1f)
                {
                    this._flooded = true;
                    this._started = false;
                }
                this._gasDripFrames++;
                if (this._gas > 0f && this._flooded && this._gasDripFrames > 2)
                {
                    FluidData gas = Fluid.Gas;
                    gas.amount = 0.003f;
                    this._gas -= 0.005f;
                    if (this._gas < 0f)
                    {
                        this._gas = 0f;
                    }
                    Level.Add(new Fluid(base.x, base.y, Vec2.Zero, gas, null, 1f));
                    this._gasDripFrames = 0;
                }
                if (this._gas <= 0f)
                {
                    this._started = false;
                }
            }
            else
            {
                this._flood -= 0.008f;
                if (this._flood < 0f)
                {
                    this._flood = 0f;
                }
            }
            if (base.duck != null)
            {
                base.duck.frictionMult = 1f;
                if (this._skipSpark > 0)
                {
                    this._skipSpark++;
                    if (this._skipSpark > 2)
                    {
                        this._skipSpark = 0;
                    }
                }
                if (base.duck.sliding && this._throttle && this._skipSpark == 0)
                {
                    if (Level.CheckLine <Block>(this.barrelStartPos + new Vec2(0f, 8f), base.barrelPosition + new Vec2(0f, 8f), null) != null)
                    {
                        this._skipSpark = 1;
                        Vec2 value = this.position + base.barrelVector * 5f;
                        for (int i = 0; i < 2; i++)
                        {
                            Level.Add(Spark.New(value.x, value.y, new Vec2((float)this.offDir * Rando.Float(0f, 2f), Rando.Float(0.5f, 1.5f)), 0.02f));
                            value += base.barrelVector * 2f;
                            this._fireTrailWait -= 0.5f;
                            if (this.souped && this._fireTrailWait <= 0f)
                            {
                                this._fireTrailWait = 1f;
                                SmallFire smallFire = SmallFire.New(value.x, value.y, (float)this.offDir * Rando.Float(0f, 2f), Rando.Float(0.5f, 1.5f), false, null, true, null, false);
                                smallFire.waitToHurt = Rando.Float(1f, 2f);
                                smallFire.whoWait    = (this.owner as Duck);
                                Level.Add(smallFire);
                            }
                        }
                        if (this.offDir > 0 && this.owner.hSpeed < (float)(this.offDir * 6) * num)
                        {
                            this.owner.hSpeed = (float)(this.offDir * 6) * num;
                        }
                        else if (this.offDir < 0 && this.owner.hSpeed > (float)(this.offDir * 6) * num)
                        {
                            this.owner.hSpeed = (float)(this.offDir * 6) * num;
                        }
                    }
                    else if (this.offDir > 0 && this.owner.hSpeed < (float)(this.offDir * 3) * num)
                    {
                        this.owner.hSpeed = (float)(this.offDir * 3) * num;
                    }
                    else if (this.offDir < 0 && this.owner.hSpeed > (float)(this.offDir * 3) * num)
                    {
                        this.owner.hSpeed = (float)(this.offDir * 3) * num;
                    }
                }
                if (this._pullState == -1)
                {
                    if (!this._throttle)
                    {
                        this._animRot    = MathHelper.Lerp(this._animRot, 0.3f, 0.2f);
                        this.handOffset  = Lerp.Vec2Smooth(this.handOffset, new Vec2(-2f, 2f), 0.25f);
                        this._holdOffset = Lerp.Vec2Smooth(this._holdOffset, new Vec2(-3f, 4f), 0.23f);
                    }
                    else if (this._shing)
                    {
                        this._animRot    = MathHelper.Lerp(this._animRot, -1.8f, 0.4f);
                        this.handOffset  = Lerp.Vec2Smooth(this.handOffset, new Vec2(1f, 0f), 0.25f);
                        this._holdOffset = Lerp.Vec2Smooth(this._holdOffset, new Vec2(1f, 2f), 0.23f);
                        if (this._animRot < -1.5f)
                        {
                            this._shing = false;
                        }
                    }
                    else if (base.duck.crouch)
                    {
                        this._animRot    = MathHelper.Lerp(this._animRot, 0.4f, 0.2f);
                        this.handOffset  = Lerp.Vec2Smooth(this.handOffset, new Vec2(1f, 0f), 0.25f);
                        this._holdOffset = Lerp.Vec2Smooth(this._holdOffset, new Vec2(1f, 2f), 0.23f);
                    }
                    else if (base.duck.inputProfile.Down("UP"))
                    {
                        this._animRot    = MathHelper.Lerp(this._animRot, -0.9f, 0.2f);
                        this.handOffset  = Lerp.Vec2Smooth(this.handOffset, new Vec2(1f, 0f), 0.25f);
                        this._holdOffset = Lerp.Vec2Smooth(this._holdOffset, new Vec2(1f, 2f), 0.23f);
                    }
                    else
                    {
                        this._animRot    = MathHelper.Lerp(this._animRot, 0f, 0.2f);
                        this.handOffset  = Lerp.Vec2Smooth(this.handOffset, new Vec2(1f, 0f), 0.25f);
                        this._holdOffset = Lerp.Vec2Smooth(this._holdOffset, new Vec2(1f, 2f), 0.23f);
                    }
                }
            }
            else if (!this._resetDuck && base.prevOwner != null)
            {
                PhysicsObject physicsObject = base.prevOwner as PhysicsObject;
                if (physicsObject != null)
                {
                    physicsObject.frictionMult = 1f;
                }
                this._resetDuck = true;
            }
            if (this._skipDebris > 0)
            {
                this._skipDebris++;
            }
            if (this._skipDebris > 3)
            {
                this._skipDebris = 0;
            }
            this._struggling = false;
            if (this.owner != null && this._started && this._throttle && !this._shing)
            {
                (this.Offset(base.barrelOffset) - this.position).Normalize();
                this.Offset(base.barrelOffset);
                IEnumerable <IAmADuck> enumerable = Level.CheckLineAll <IAmADuck>(this.barrelStartPos, base.barrelPosition);
                Block block3 = Level.CheckLine <Block>(this.barrelStartPos, base.barrelPosition, null);
                if (this.owner != null)
                {
                    foreach (MaterialThing materialThing in Level.CheckLineAll <MaterialThing>(this.barrelStartPos, base.barrelPosition))
                    {
                        if (materialThing.Hurt((materialThing is Door) ? 1.8f : 0.5f))
                        {
                            if (base.duck != null && base.duck.sliding && materialThing is Door && (materialThing as Door)._jammed)
                            {
                                materialThing.Destroy(new DTImpale(this));
                            }
                            else
                            {
                                this._struggling = true;
                                if (base.duck != null)
                                {
                                    base.duck.frictionMult = 4f;
                                }
                                if (this._skipDebris == 0)
                                {
                                    this._skipDebris = 1;
                                    Vec2 value2 = Collision.LinePoint(this.barrelStartPos, base.barrelPosition, materialThing.rectangle);
                                    if (value2 != Vec2.Zero)
                                    {
                                        value2 += base.barrelVector * Rando.Float(0f, 3f);
                                        Vec2 vec = -base.barrelVector.Rotate(Rando.Float(-0.2f, 0.2f), Vec2.Zero);
                                        if (materialThing.physicsMaterial == PhysicsMaterial.Wood)
                                        {
                                            WoodDebris woodDebris = WoodDebris.New(value2.x, value2.y);
                                            woodDebris.hSpeed = vec.x * 3f;
                                            woodDebris.vSpeed = vec.y * 3f;
                                            Level.Add(woodDebris);
                                        }
                                        else if (materialThing.physicsMaterial == PhysicsMaterial.Metal)
                                        {
                                            Spark spark = Spark.New(value2.x, value2.y, Vec2.Zero, 0.02f);
                                            spark.hSpeed = vec.x * 3f;
                                            spark.vSpeed = vec.y * 3f;
                                            Level.Add(spark);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                bool flag3 = false;
                if (block3 != null && !(block3 is Door))
                {
                    this.Shing(block3);
                    if (block3 is Window)
                    {
                        block3.Destroy(new DTImpact(this));
                    }
                }
                else
                {
                    foreach (Thing thing in Level.current.things[typeof(Sword)])
                    {
                        Sword sword = (Sword)thing;
                        if (sword.owner != null && sword.crouchStance && !sword.jabStance && Collision.LineIntersect(this.barrelStartPos, base.barrelPosition, sword.barrelStartPos, sword.barrelPosition))
                        {
                            this.Shing(sword);
                            sword.Shing();
                            sword.owner.hSpeed     += (float)this.offDir * 3f;
                            sword.owner.vSpeed     -= 2f;
                            base.duck.hSpeed       += -(float)this.offDir * 3f;
                            base.duck.vSpeed       -= 2f;
                            sword.duck.crippleTimer = 1f;
                            base.duck.crippleTimer  = 1f;
                            flag3 = true;
                        }
                    }
                    if (!flag3)
                    {
                        Thing ignore = null;
                        if (base.duck != null)
                        {
                            ignore = base.duck.GetEquipment(typeof(Helmet));
                        }
                        QuadLaserBullet quadLaserBullet = Level.CheckLine <QuadLaserBullet>(this.position, base.barrelPosition, null);
                        if (quadLaserBullet != null)
                        {
                            this.Shing(quadLaserBullet);
                            Vec2  travel = quadLaserBullet.travel;
                            float length = travel.length;
                            float num6   = 1f;
                            if (this.offDir > 0 && travel.x < 0f)
                            {
                                num6 = 1.5f;
                            }
                            else if (this.offDir < 0 && travel.x > 0f)
                            {
                                num6 = 1.5f;
                            }
                            if (this.offDir > 0)
                            {
                                travel = new Vec2(length * num6, 0f);
                            }
                            else
                            {
                                travel = new Vec2(-length * num6, 0f);
                            }
                            quadLaserBullet.travel = travel;
                        }
                        else
                        {
                            Helmet helmet = Level.CheckLine <Helmet>(this.barrelStartPos, base.barrelPosition, ignore);
                            if (helmet != null && helmet.equippedDuck != null)
                            {
                                this.Shing(helmet);
                                helmet.owner.hSpeed     += (float)this.offDir * 3f;
                                helmet.owner.vSpeed     -= 2f;
                                helmet.duck.crippleTimer = 1f;
                                helmet.Hurt(0.53f);
                                flag3 = true;
                            }
                            else
                            {
                                if (base.duck != null)
                                {
                                    ignore = base.duck.GetEquipment(typeof(ChestPlate));
                                }
                                ChestPlate chestPlate = Level.CheckLine <ChestPlate>(this.barrelStartPos, base.barrelPosition, ignore);
                                if (chestPlate != null && chestPlate.equippedDuck != null)
                                {
                                    this.Shing(chestPlate);
                                    chestPlate.owner.hSpeed     += (float)this.offDir * 3f;
                                    chestPlate.owner.vSpeed     -= 2f;
                                    chestPlate.duck.crippleTimer = 1f;
                                    chestPlate.Hurt(0.53f);
                                    flag3 = true;
                                }
                            }
                        }
                    }
                }
                if (!flag3)
                {
                    foreach (Thing thing2 in Level.current.things[typeof(Chainsaw)])
                    {
                        Chainsaw chainsaw = (Chainsaw)thing2;
                        if (chainsaw != this && chainsaw.owner != null && Collision.LineIntersect(this.barrelStartPos, base.barrelPosition, chainsaw.barrelStartPos, chainsaw.barrelPosition))
                        {
                            this.Shing(chainsaw);
                            chainsaw.Shing(this);
                            chainsaw.owner.hSpeed     += (float)this.offDir * 2f;
                            chainsaw.owner.vSpeed     -= 1.5f;
                            base.duck.hSpeed          += -(float)this.offDir * 2f;
                            base.duck.vSpeed          -= 1.5f;
                            chainsaw.duck.crippleTimer = 1f;
                            base.duck.crippleTimer     = 1f;
                            flag3 = true;
                            if (Recorder.currentRecording != null)
                            {
                                Recorder.currentRecording.LogBonus();
                            }
                        }
                    }
                }
                if (!flag3)
                {
                    foreach (IAmADuck amADuck in enumerable)
                    {
                        if (amADuck != base.duck)
                        {
                            MaterialThing materialThing2 = amADuck as MaterialThing;
                            if (materialThing2 != null)
                            {
                                materialThing2.velocity += new Vec2((float)this.offDir * 0.8f, -0.8f);
                                materialThing2.Destroy(new DTImpale(this));
                                if (base.duck != null)
                                {
                                    base.duck._timeSinceChainKill = 0;
                                }
                            }
                        }
                    }
                }
            }
        }