Example #1
0
 // Token: 0x06000CCA RID: 3274
 public override void Update()
 {
     base.Update();
     if (this._swordSwing.finished)
     {
         this._swordSwing.speed = 0f;
     }
     if (this._hitWait > 0)
     {
         this._hitWait--;
     }
     this._framesExisting++;
     if (this._framesExisting > 100)
     {
         this._framesExisting = 100;
     }
     if (Math.Abs(this.hSpeed) + Math.Abs(this.vSpeed) > 4f && this._framesExisting > 10)
     {
         this._wasLifted = true;
     }
     if (this.owner != null)
     {
         this._hold              = -0.4f;
         this._wasLifted         = true;
         this.center             = new Vec2(4f, 21f);
         this._framesSinceThrown = 0;
     }
     else
     {
         if (this._framesSinceThrown == 1)
         {
             this._throwSpin = Maths.RadToDeg(this.angle) - 90f;
             this._hold      = 0f;
             this._swing     = 0f;
         }
         if (this._wasLifted)
         {
             base.angleDegrees = 90f + this._throwSpin;
             this.center       = new Vec2(4f, 11f);
         }
         this._volatile = false;
         bool spinning    = false;
         bool againstWall = false;
         if (Math.Abs(this.hSpeed) + Math.Abs(this.vSpeed) > 2f || !base.grounded)
         {
             if (!base.grounded && Level.CheckRect <Block>(this.position + new Vec2(-6f, -6f), this.position + new Vec2(6f, -2f), null) != null)
             {
                 againstWall = true;
                 if (this.vSpeed > 4f)
                 {
                     this._volatile = true;
                 }
             }
             if (!againstWall && !this._grounded && Level.CheckPoint <IPlatform>(this.position + new Vec2(0f, 8f), null, null) == null)
             {
                 if (this.hSpeed > 0f)
                 {
                     this._throwSpin += (Math.Abs(this.hSpeed) + Math.Abs(this.vSpeed)) * 2f + 4f;
                 }
                 else
                 {
                     this._throwSpin -= (Math.Abs(this.hSpeed) + Math.Abs(this.vSpeed)) * 2f + 4f;
                 }
                 spinning = true;
             }
         }
         if (this._framesExisting > 15 && Math.Abs(this.hSpeed) + Math.Abs(this.vSpeed) > 3f)
         {
             this._volatile = true;
         }
         if (!spinning || againstWall)
         {
             this._throwSpin %= 360f;
             if (againstWall)
             {
                 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 (this._volatile && this._hitWait == 0)
         {
             (this.Offset(base.barrelOffset) - this.position).Normalize();
             this.Offset(base.barrelOffset);
             bool rebound = false;
             foreach (Thing thing in Level.current.things[typeof(Sword)])
             {
                 Sword s = (Sword)thing;
                 if (s != this && s.owner != null && s._crouchStance && !s._jabStance && !s._jabStance && ((this.hSpeed > 0f && s.x > base.x - 4f) || (this.hSpeed < 0f && s.x < base.x + 4f)) && Collision.LineIntersect(this.barrelStartPos, base.barrelPosition, s.barrelStartPos, s.barrelPosition))
                 {
                     this.Shing();
                     s.Shing();
                     s.owner.hSpeed += (float)this.offDir * 1f;
                     s.owner.vSpeed -= 1f;
                     rebound         = true;
                     this._hitWait   = 4;
                     this.hSpeed     = -this.hSpeed * 0.6f;
                 }
             }
             int waitFrames = 12;
             if (!rebound)
             {
                 foreach (Thing thing2 in Level.current.things[typeof(Chainsaw)])
                 {
                     Chainsaw s2 = (Chainsaw)thing2;
                     if (s2.owner != null && s2.throttle && Collision.LineIntersect(this.barrelStartPos, base.barrelPosition, s2.barrelStartPos, s2.barrelPosition))
                     {
                         this.Shing();
                         s2.Shing(this);
                         s2.owner.hSpeed += (float)this.offDir * 1f;
                         s2.owner.vSpeed -= 1f;
                         rebound          = true;
                         this.hSpeed      = -this.hSpeed * 0.6f;
                         this._hitWait    = 4;
                         if (Recorder.currentRecording != null)
                         {
                             Recorder.currentRecording.LogBonus();
                         }
                     }
                 }
                 if (!rebound)
                 {
                     Helmet helmetHit = Level.CheckLine <Helmet>(this.barrelStartPos, base.barrelPosition, null);
                     if (helmetHit != null && helmetHit.equippedDuck != null && (helmetHit.owner != base.prevOwner || (int)this._framesSinceThrown > waitFrames))
                     {
                         this.hSpeed = -this.hSpeed * 0.6f;
                         this.Shing();
                         rebound       = true;
                         this._hitWait = 4;
                     }
                     else
                     {
                         ChestPlate chestHit = Level.CheckLine <ChestPlate>(this.barrelStartPos, base.barrelPosition, null);
                         if (chestHit != null && chestHit.equippedDuck != null && (chestHit.owner != base.prevOwner || (int)this._framesSinceThrown > waitFrames))
                         {
                             this.hSpeed = -this.hSpeed * 0.6f;
                             this.Shing();
                             rebound       = true;
                             this._hitWait = 4;
                         }
                     }
                 }
             }
             if (!rebound && base.isServerForObject)
             {
                 foreach (IAmADuck d in Level.CheckLineAll <IAmADuck>(this.barrelStartPos, base.barrelPosition))
                 {
                     if (d != base.duck)
                     {
                         MaterialThing realThing = d as MaterialThing;
                         if (realThing != null && (realThing != base.prevOwner || (int)this._framesSinceThrown > waitFrames))
                         {
                             realThing.Destroy(new DTImpale(this));
                             if (Recorder.currentRecording != null)
                             {
                                 Recorder.currentRecording.LogBonus();
                             }
                         }
                     }
                 }
             }
         }
     }
     if (this.owner == null)
     {
         this._swinging     = false;
         this._jabStance    = false;
         this._crouchStance = false;
         this._pullBack     = false;
         this._swung        = false;
         this._shing        = false;
         this._swing        = 0f;
         this._swingPress   = false;
         this._slamStance   = false;
         this._unslam       = 0;
     }
     if (base.isServerForObject)
     {
         if (this._unslam > 1)
         {
             this._unslam--;
             this._slamStance = true;
         }
         else if (this._unslam == 1)
         {
             this._unslam     = 0;
             this._slamStance = false;
         }
         if (this._pullBack)
         {
             if (base.duck != null)
             {
                 if (this._jabStance)
                 {
                     this._pullBack = false;
                     this._swinging = true;
                 }
                 else
                 {
                     this._swinging = true;
                     this._pullBack = false;
                 }
             }
         }
         else if (this._swinging)
         {
             if (this._jabStance)
             {
                 this._addOffsetX = MathHelper.Lerp(this._addOffsetX, 3f, 0.4f);
                 if (this._addOffsetX > 2f && !this.action)
                 {
                     this._swinging = false;
                 }
             }
             else if (base.raised)
             {
                 this._swing = MathHelper.Lerp(this._swing, -2.8f, 0.2f);
                 if (this._swing < -2.4f && !this.action)
                 {
                     this._swinging = false;
                     this._swing    = 1.8f;
                 }
             }
             else
             {
                 this._swing = MathHelper.Lerp(this._swing, 2.1f, 0.4f);
                 if (this._swing > 1.8f && !this.action)
                 {
                     this._swinging = false;
                     this._swing    = 1.8f;
                 }
             }
         }
         else
         {
             if (!this._swinging && (!this._swingPress || this._shing || (this._jabStance && this._addOffsetX < 1f) || (!this._jabStance && this._swing < 1.6f)))
             {
                 if (this._jabStance)
                 {
                     this._swing = MathHelper.Lerp(this._swing, 1.75f, 0.4f);
                     if (this._swing > 1.55f)
                     {
                         this._swing = 1.55f;
                         this._shing = false;
                         this._swung = false;
                     }
                     this._addOffsetX = MathHelper.Lerp(this._addOffsetX, -12f, 0.45f);
                     if (this._addOffsetX < -12f)
                     {
                         this._addOffsetX = -12f;
                     }
                     this._addOffsetY = MathHelper.Lerp(this._addOffsetY, -4f, 0.35f);
                     if (this._addOffsetX < -3f)
                     {
                         this._addOffsetY = -3f;
                     }
                 }
                 else if (this._slamStance)
                 {
                     this._swing = MathHelper.Lerp(this._swing, 3.14f, 0.8f);
                     if (this._swing > 3.1f && this._unslam == 0)
                     {
                         this._swing = 3.14f;
                         this._shing = false;
                         this._swung = true;
                     }
                     this._addOffsetX = MathHelper.Lerp(this._addOffsetX, -5f, 0.45f);
                     if (this._addOffsetX < -4.6f)
                     {
                         this._addOffsetX = -5f;
                     }
                     this._addOffsetY = MathHelper.Lerp(this._addOffsetY, -6f, 0.35f);
                     if (this._addOffsetX < -5.5f)
                     {
                         this._addOffsetY = -6f;
                     }
                 }
                 else
                 {
                     this._swing      = MathHelper.Lerp(this._swing, -0.22f, 0.36f);
                     this._addOffsetX = MathHelper.Lerp(this._addOffsetX, 1f, 0.2f);
                     if (this._addOffsetX > 0f)
                     {
                         this._addOffsetX = 0f;
                     }
                     this._addOffsetY = MathHelper.Lerp(this._addOffsetY, 1f, 0.2f);
                     if (this._addOffsetY > 0f)
                     {
                         this._addOffsetY = 0f;
                     }
                 }
             }
             if ((this._swing < 0f || this._jabStance) && this._swing < 0f)
             {
                 this._swing = 0f;
                 this._shing = false;
                 this._swung = false;
             }
         }
     }
     if (base.duck != null)
     {
         this.collisionOffset = new Vec2(-4f, 0f);
         this.collisionSize   = new Vec2(4f, 4f);
         if (this._crouchStance && !this._jabStance)
         {
             this.collisionOffset = new Vec2(-2f, -19f);
             this.collisionSize   = new Vec2(4f, 16f);
             this.thickness       = 3f;
         }
         this._swingPress = false;
         if (!this._pullBack && !this._swinging)
         {
             this._crouchStance = false;
             this._jabStance    = false;
             if (base.duck.crouch)
             {
                 if (!this._pullBack && !this._swinging && base.duck.inputProfile.Down((this.offDir > 0) ? "LEFT" : "RIGHT"))
                 {
                     this._jabStance = true;
                 }
                 this._crouchStance = true;
             }
             if (!this._crouchStance || this._jabStance)
             {
                 this._slamStance = false;
             }
         }
         if (!this._crouchStance)
         {
             this._hold       = -0.4f;
             this.handOffset  = new Vec2(this._addOffsetX, this._addOffsetY);
             this._holdOffset = new Vec2(-4f + this._addOffsetX, 4f + this._addOffsetY);
         }
         else
         {
             this._hold       = 0f;
             this._holdOffset = new Vec2(0f + this._addOffsetX, 4f + this._addOffsetY);
             this.handOffset  = new Vec2(3f + this._addOffsetX, this._addOffsetY);
         }
     }
     else
     {
         this.collisionOffset = new Vec2(-2f, -16f);
         this.collisionSize   = new Vec2(4f, 18f);
         if (this._wasLifted)
         {
             this.collisionOffset = new Vec2(-4f, -2f);
             this.collisionSize   = new Vec2(8f, 4f);
         }
         this.thickness = 0f;
     }
     if ((this._swung || this._swinging) && !this._shing)
     {
         (this.Offset(base.barrelOffset) - this.position).Normalize();
         this.Offset(base.barrelOffset);
         IEnumerable <IAmADuck> hit2 = Level.CheckLineAll <IAmADuck>(this.barrelStartPos, base.barrelPosition);
         Block wallHit = Level.CheckLine <Block>(this.barrelStartPos, base.barrelPosition, null);
         if (wallHit != null && !this._slamStance)
         {
             if (this.offDir < 0 && wallHit.x > base.x)
             {
                 wallHit = null;
             }
             else if (this.offDir > 0 && wallHit.x < base.x)
             {
                 wallHit = null;
             }
         }
         bool clashed = false;
         if (wallHit != null)
         {
             this.Shing();
             if (this._slamStance)
             {
                 this._swung       = false;
                 this._unslam      = 20;
                 this.owner.vSpeed = -5f;
             }
             if (wallHit is Window)
             {
                 wallHit.Destroy(new DTImpact(this));
             }
         }
         else if (!this._jabStance && !this._slamStance)
         {
             Thing ignore = null;
             if (base.duck != null)
             {
                 ignore = base.duck.GetEquipment(typeof(Helmet));
             }
             Vec2            barrel   = base.barrelPosition + base.barrelVector * 3f;
             Vec2            p3       = new Vec2((this.position.x < barrel.x) ? this.position.x : barrel.x, (this.position.y < barrel.y) ? this.position.y : barrel.y);
             Vec2            p2       = new Vec2((this.position.x > barrel.x) ? this.position.x : barrel.x, (this.position.y > barrel.y) ? this.position.y : barrel.y);
             QuadLaserBullet laserHit = Level.CheckRect <QuadLaserBullet>(p3, p2, null);
             if (laserHit != null)
             {
                 this.Shing();
                 base.Fondle(laserHit);
                 laserHit.safeFrames = 8;
                 laserHit.safeDuck   = base.duck;
                 Vec2  travel = laserHit.travel;
                 float mag    = travel.length;
                 float mul    = 1f;
                 if (this.offDir > 0 && travel.x < 0f)
                 {
                     mul = 1.5f;
                 }
                 else if (this.offDir < 0 && travel.x > 0f)
                 {
                     mul = 1.5f;
                 }
                 if (this.offDir > 0)
                 {
                     travel = new Vec2(mag * mul, 0f);
                 }
                 else
                 {
                     travel = new Vec2(-mag * mul, 0f);
                 }
                 laserHit.travel = travel;
             }
             else
             {
                 Helmet helmetHit2 = Level.CheckLine <Helmet>(this.barrelStartPos, base.barrelPosition, ignore);
                 if (helmetHit2 != null && helmetHit2.equippedDuck != null)
                 {
                     this.Shing();
                     helmetHit2.owner.hSpeed     += (float)this.offDir * 3f;
                     helmetHit2.owner.vSpeed     -= 2f;
                     helmetHit2.duck.crippleTimer = 1f;
                     helmetHit2.Hurt(0.53f);
                     clashed = true;
                 }
                 else
                 {
                     if (base.duck != null)
                     {
                         ignore = base.duck.GetEquipment(typeof(ChestPlate));
                     }
                     ChestPlate chestHit2 = Level.CheckLine <ChestPlate>(this.barrelStartPos, base.barrelPosition, ignore);
                     if (chestHit2 != null && chestHit2.equippedDuck != null)
                     {
                         this.Shing();
                         chestHit2.owner.hSpeed     += (float)this.offDir * 3f;
                         chestHit2.owner.vSpeed     -= 2f;
                         chestHit2.duck.crippleTimer = 1f;
                         chestHit2.Hurt(0.53f);
                         clashed = true;
                     }
                 }
             }
         }
         if (!clashed)
         {
             foreach (Thing thing3 in Level.current.things[typeof(Sword)])
             {
                 Sword s3 = (Sword)thing3;
                 if (s3 != this && s3.duck != null && !this._jabStance && !s3._jabStance && base.duck != null && Collision.LineIntersect(this.barrelStartPos, base.barrelPosition, s3.barrelStartPos, s3.barrelPosition))
                 {
                     this.Shing();
                     s3.Shing();
                     s3.owner.hSpeed       += (float)this.offDir * 3f;
                     s3.owner.vSpeed       -= 2f;
                     base.duck.hSpeed      += -(float)this.offDir * 3f;
                     base.duck.vSpeed      -= 2f;
                     s3.duck.crippleTimer   = 1f;
                     base.duck.crippleTimer = 1f;
                     clashed = true;
                 }
             }
         }
         if (clashed)
         {
             return;
         }
         using (IEnumerator <IAmADuck> enumerator5 = hit2.GetEnumerator())
         {
             while (enumerator5.MoveNext())
             {
                 IAmADuck d2 = enumerator5.Current;
                 if (d2 != base.duck)
                 {
                     MaterialThing realThing2 = d2 as MaterialThing;
                     if (realThing2 != null)
                     {
                         realThing2.Destroy(new DTImpale(this));
                     }
                 }
             }
             return;
         }
     }
     if (this._crouchStance && base.duck != null)
     {
         foreach (IAmADuck d3 in Level.CheckLineAll <IAmADuck>(this.barrelStartPos, base.barrelPosition))
         {
             if (d3 != base.duck)
             {
                 MaterialThing realThing3 = d3 as MaterialThing;
                 if (realThing3 != null)
                 {
                     if (realThing3.vSpeed > 0.5f && realThing3.bottom < this.position.y - 8f && realThing3.left < base.barrelPosition.x && realThing3.right > base.barrelPosition.x)
                     {
                         realThing3.Destroy(new DTImpale(this));
                     }
                     else if (!this._jabStance && !realThing3.destroyed && ((this.offDir > 0 && realThing3.x > base.duck.x) || (this.offDir < 0 && realThing3.x < base.duck.x)))
                     {
                         if (realThing3 is Duck)
                         {
                             (realThing3 as Duck).crippleTimer = 1f;
                         }
                         else if ((base.duck.x > realThing3.x && realThing3.hSpeed > 1.5f) || (base.duck.x < realThing3.x && realThing3.hSpeed < -1.5f))
                         {
                             realThing3.Destroy(new DTImpale(this));
                         }
                         base.Fondle(realThing3);
                         realThing3.hSpeed = (float)this.offDir * 3f;
                         realThing3.vSpeed = -2f;
                     }
                 }
             }
         }
     }
 }
Example #2
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;
                                }
                            }
                        }
                    }
                }
            }
        }