Пример #1
0
 public override void PostDrawLayer(Layer layer)
 {
     if (layer == Layer.Background)
     {
         Vec2  vec2_1 = new Vec2(0.0f, 0.0f);
         float num1   = -260f;
         float num2   = 140f;
         for (int index1 = 0; index1 < 7; ++index1)
         {
             int    index2 = this.ProfileIndexAdd(this._selectorPosition, index1 - 3);
             string str    = "NO PROFILE";
             if (index2 != -1)
             {
                 str = this._profiles[index2].name;
             }
             float num3 = (float)((double)vec2_1.x + (double)num1 + 3.0 * (double)num2);
             float x    = (float)((double)vec2_1.x + (double)num1 + (double)index1 * (double)num2 + -(double)this._slide * (double)num2);
             float num4 = Maths.Clamp((float)((100.0 - (double)Math.Abs(x - num3)) / 100.0), 0.0f, 1f);
             float num5 = num4 * Maths.NormalizeSection(num4, 0.0f, 0.9f);
             this._door.color = Color.White * num5 * this._fade;
             this._door.depth = (Depth)(num5 * 0.8f);
             if ((double)num5 < 1.0)
             {
                 this._unlitDoor.alpha = (float)((1.0 - (double)num5) * 0.5) * this._fade;
                 Graphics.Draw(this._unlitDoor, x, 90f);
             }
             if ((double)num5 > 0.0)
             {
                 Graphics.Draw(this._door, x, 90f);
             }
             string text   = str;
             float  num6   = (float)(((double)num5 + 1.0) * 0.5);
             float  num7   = 0.0f;
             float  num8   = 0.0f;
             Vec2   vec2_2 = new Vec2(1f, 1f);
             if (text.Length > 9)
             {
                 vec2_2 = new Vec2(0.75f, 0.75f);
                 num7   = 1f;
                 num8   = 1f;
             }
             if (text.Length > 12)
             {
                 vec2_2 = new Vec2(0.5f, 0.5f);
                 num7   = 2f;
                 num8   = 1f;
             }
             Graphics.DrawString(text, new Vec2(x - Graphics.GetStringWidth(text, scale: vec2_2.x) / 2f + num8, 35f + num7), new Color((byte)Math.Round(165.0 * (double)num6), (byte)Math.Round(100.0 * (double)num6), (byte)Math.Round(34.0 * (double)num6)) * this._fade, new Depth(0.9f), scale: vec2_2.x);
         }
         this._door.scale = new Vec2(1f, 1f);
         this._door.depth = new Depth(0.4f);
     }
     base.PostDrawLayer(layer);
 }
Пример #2
0
 public override void Update()
 {
     if (this._topBullet != null)
     {
         this._topBullet.DoUpdate();
         int num = (int)((double)this.ammo / (double)this.bulletsTillRemove);
         if (num < this.numHanging)
         {
             this._topBullet = this._topBullet.childThing as ChaingunBullet;
             if (this._topBullet != null)
             {
                 this._topBullet.parentThing = (Thing)this;
             }
         }
         this.numHanging = num;
     }
     this._fireWait = (float)(0.699999988079071 + (double)Maths.NormalizeSection(this._barrelHeat, 5f, 9f) * 5.0);
     if ((double)this._barrelHeat > 11.0)
     {
         this._barrelHeat = 11f;
     }
     this._barrelHeat -= 0.005f;
     if ((double)this._barrelHeat < 0.0)
     {
         this._barrelHeat = 0.0f;
     }
     this._sprite.speed = this._spin;
     this._tip.speed    = this._spin;
     if ((double)this._spin > 0.0)
     {
         this._spin -= 0.01f;
     }
     else
     {
         this._spin = 0.0f;
     }
     base.Update();
     if (this._topBullet == null)
     {
         return;
     }
     if (!this.graphic.flipH)
     {
         this._topBullet.chainOffset = new Vec2(1f, 5f);
     }
     else
     {
         this._topBullet.chainOffset = new Vec2(-1f, 5f);
     }
 }
Пример #3
0
 public override void Update()
 {
     if (!this.burntOut && (double)this.burnt >= 1.0)
     {
         Vec2 vec2 = this.Offset(new Vec2(10f, 0.0f));
         Level.Add((Thing)SmallSmoke.New(vec2.x, vec2.y));
         this._onFire   = false;
         this.flammable = 0.0f;
         this.burntOut  = true;
     }
     if (this._topBullet != null)
     {
         this._topBullet.DoUpdate();
         int num = (int)((double)this.ammo / (double)this.bulletsTillRemove);
         if (num < this.numHanging)
         {
             this._topBullet = this._topBullet.childThing as ChaingunBullet;
             if (this._topBullet != null)
             {
                 this._topBullet.parentThing = (Thing)this;
             }
         }
         this.numHanging = num;
     }
     this._fireWait = (float)(0.649999976158142 + (double)Maths.NormalizeSection(this._barrelHeat, 5f, 9f) * 3.0) + Rando.Float(0.25f);
     if ((double)this._barrelHeat > 10.0)
     {
         this._barrelHeat = 10f;
     }
     this._barrelHeat -= 0.005f;
     if ((double)this._barrelHeat < 0.0)
     {
         this._barrelHeat = 0.0f;
     }
     if (!this.burntOut)
     {
         this._sprite.speed = this._spin;
         this._tip.speed    = this._spin;
         if ((double)this._spin > 0.0)
         {
             this._spin -= 0.01f;
         }
         else
         {
             this._spin = 0.0f;
         }
     }
     base.Update();
     if (this._topBullet == null)
     {
         return;
     }
     if (!this.graphic.flipH)
     {
         this._topBullet.chainOffset = new Vec2(1f, 5f);
     }
     else
     {
         this._topBullet.chainOffset = new Vec2(-1f, 5f);
     }
 }
        public override void Update()
        {
            if (this.isServerForObject)
            {
                this.xscale = this.yscale = Maths.CountUp(this.yscale, 0.05f);
                this._fade -= 0.05f;
                if ((double)this._fade < 0.0)
                {
                    Level.Remove((Thing)this);
                }
                this.alpha = Maths.NormalizeSection(this._fade, 0.2f, 0.3f);
                Vec2 p2 = Vec2.Zero;
                if (this._owner.controlledDuck == null && !this._isNotControlRay)
                {
                    p2 = new Vec2((float)Math.Cos((double)this.angle), (float)-Math.Sin((double)this.angle));
                    foreach (IAmADuck amAduck in Level.CheckCircleAll <IAmADuck>(this.position, 3f))
                    {
                        switch (amAduck)
                        {
                        case Duck _:
                            if (!(amAduck as Duck).HasEquipment(typeof(TinfoilHat)) && !((amAduck as Duck).holdObject is MindControlRay))
                            {
                                this._owner.ControlDuck(amAduck as Duck);
                                continue;
                            }
                            continue;

                        case RagdollPart _ when(amAduck as RagdollPart).doll.captureDuck != null:
                            this._owner.ControlDuck((amAduck as RagdollPart).doll.captureDuck);

                            continue;

                        case TrappedDuck _ when(amAduck as TrappedDuck).captureDuck != null:
                            this._owner.ControlDuck((amAduck as TrappedDuck).captureDuck);

                            continue;

                        default:
                            continue;
                        }
                    }
                }
                else
                {
                    if (this._owner.controlledDuck != null)
                    {
                        p2 = this._owner.controlledDuck.cameraPosition - this.position;
                        p2.Normalize();
                        this.angleDegrees = -Maths.PointDirection(Vec2.Zero, p2);
                    }
                    this._isNotControlRay = true;
                }
                ControlWave controlWave = this;
                controlWave.position = controlWave.position + p2 * 2.6f;
            }
            else
            {
                this.xscale = this.yscale = 1f;
                Vec2        vec2        = new Vec2((float)Math.Cos((double)this.angle), (float)-Math.Sin((double)this.angle));
                ControlWave controlWave = this;
                controlWave.position = controlWave.position + vec2 * 2.6f;
            }
        }
Пример #5
0
        public void Draw()
        {
            if ((double)this._wait > 1.0)
            {
                bool flag = true;
                for (int index1 = 0; index1 < this._cool.Count; ++index1)
                {
                    if (this._sampleCool[index1] < this._cool[index1])
                    {
                        List <int> cool;
                        int        index2;
                        (cool = this._cool)[index2 = index1] = cool[index2] - 1;
                        flag = false;
                    }
                    else if (this._sampleCool[index1] > this._cool[index1])
                    {
                        List <int> cool;
                        int        index2;
                        (cool = this._cool)[index2 = index1] = cool[index2] + 1;
                        flag = false;
                    }
                    if ((double)this._upScale[index1] > 0.0)
                    {
                        List <float> upScale;
                        int          index2;
                        (upScale = this._upScale)[index2 = index1] = upScale[index2] - 0.05f;
                    }
                }
                if (flag)
                {
                    this._wait += 0.015f;
                    if ((double)this._wait > 2.0)
                    {
                        this._readyToTalk = true;
                    }
                }
            }
            else
            {
                this._wait += 0.01f;
            }
            this._redBar.depth = new Depth(0.2f);
            Graphics.Draw(this._redBar, 30f, 25f);
            this._font.depth = new Depth(0.25f);
            if (DG.isHalloween)
            {
                this._font.Draw("SPOOKY  REPORT", 44f, 28f, Color.White, new Depth(0.25f));
            }
            else
            {
                this._font.Draw("HOTNESS REPORT", 44f, 28f, Color.White, new Depth(0.25f));
            }
            this._blueBar.depth = new Depth(0.1f);
            Graphics.Draw(this._blueBar, 30f, 18f);
            Graphics.DrawRect(new Vec2(20f, 135f), new Vec2(260f, 160f), new Color(12, 90, 182), new Depth(0.1f));
            Vec2           vec2_1 = new Vec2(60f, 50f);
            Vec2           vec2_2 = new Vec2(200f, 150f);
            Vec2           vec2_3 = new Vec2(vec2_2.x - vec2_1.x, vec2_2.y - vec2_1.y);
            List <Profile> active = Profiles.active;
            int            index3 = 0;

            foreach (Profile profile in active)
            {
                float num1   = active.Count != 1 ? (active.Count != 2 ? (float)index3 * (vec2_3.x / (float)(active.Count - 1)) : (float)((double)vec2_3.x / 2.0 - (double)vec2_3.x / 4.0 + (double)index3 * ((double)vec2_3.x / 2.0))) : vec2_3.x / 2f;
                float num2   = (float)(this._cool[index3] + 50) / 250f;
                float num3   = 1f / (float)(this._tempMap.Count - 2);
                int   index1 = (int)((double)num2 * (double)(this._tempMap.Count - 2));
                if (index1 < 0)
                {
                    index1 = 0;
                }
                int   temp = this._tempMap[index1];
                float num4 = Maths.NormalizeSection(num2, num3 * (float)index1, num3 * (float)(index1 + 1));
                int   num5 = (int)((double)this._tempMap[index1] + (double)(this._tempMap[index1 + 1] - this._tempMap[index1]) * (double)num4);
                float num6 = 50f;
                float num7 = num2 + 0.28f;
                float x    = vec2_1.x + num1;
                float y    = (float)((double)vec2_2.y - 32.0 - (double)num7 * (double)num6);
                profile.persona.sprite.depth = new Depth(0.3f);
                profile.persona.sprite.color = Color.White;
                Graphics.Draw(profile.persona.sprite, 0, x, y);
                Vec2 hatPoint = DuckRig.GetHatPoint(profile.persona.sprite.imageIndex);
                profile.team.hat.depth  = new Depth(0.31f);
                profile.team.hat.center = new Vec2(16f, 16f) + profile.team.hatOffset;
                Graphics.Draw(profile.team.hat, profile.team.hat.frame, x + hatPoint.x, y + hatPoint.y);
                Graphics.DrawRect(new Vec2(x - 17f, y + 16f), new Vec2(x + 16f, 160f), profile.persona.colorUsable, new Depth(0.05f));
                string text = num5.ToString() + "=";
                this._font.depth = new Depth(0.25f);
                this._font.Draw(text, new Vec2((float)((double)x - (double)this._font.GetWidth(text) / 2.0 + 3.0), 140f), Color.White, new Depth(0.25f));
                this._icon.depth = new Depth(0.3f);
                this._icon.frame = (int)Math.Floor((double)num2 * 8.98999977111816);
                if (this._icon.frame != this._lastFrame[index3])
                {
                    this._lastFrame[index3] = this._icon.frame;
                    this._upScale[index3]   = 0.5f;
                }
                this._icon.scale = new Vec2(1f + this._upScale[index3]);
                Graphics.Draw((Sprite)this._icon, x, y + 28f);
                ++index3;
            }
        }
        private RockWeatherState GetWeatherState(float time, bool lerp = true)
        {
            RockWeatherState rockWeatherState1 = (RockWeatherState)null;
            RockWeatherState rockWeatherState2 = (RockWeatherState)null;
            float            num1 = 0.0f;
            int index             = 0;

            switch (RockWeather._weather)
            {
            case Weather.Sunny:
                num1  = 1f / (float)this.timeOfDayColorMultMap.Count;
                index = (int)((double)RockWeather._timeOfDay * (double)this.timeOfDayColorMultMap.Count);
                if (index >= this.timeOfDayColorMultMap.Count)
                {
                    index = this.timeOfDayColorMultMap.Count - 1;
                }
                rockWeatherState1 = this.timeOfDayColorMultMap[index];
                rockWeatherState2 = index + 1 <= this.timeOfDayColorMultMap.Count - 1 ? this.timeOfDayColorMultMap[index + 1] : this.timeOfDayColorMultMap[0];
                break;

            case Weather.Snowing:
                num1  = 1f / (float)this.timeOfDayColorMultMapWinter.Count;
                index = (int)((double)RockWeather._timeOfDay * (double)this.timeOfDayColorMultMapWinter.Count);
                if (index >= this.timeOfDayColorMultMapWinter.Count)
                {
                    index = this.timeOfDayColorMultMapWinter.Count - 1;
                }
                rockWeatherState1 = this.timeOfDayColorMultMapWinter[index];
                rockWeatherState2 = index + 1 <= this.timeOfDayColorMultMapWinter.Count - 1 ? this.timeOfDayColorMultMapWinter[index + 1] : this.timeOfDayColorMultMapWinter[0];
                break;

            case Weather.Raining:
                num1  = 1f / (float)this.timeOfDayColorMultMapRaining.Count;
                index = (int)((double)RockWeather._timeOfDay * (double)this.timeOfDayColorMultMapRaining.Count);
                if (index >= this.timeOfDayColorMultMapRaining.Count)
                {
                    index = this.timeOfDayColorMultMapRaining.Count - 1;
                }
                rockWeatherState1 = this.timeOfDayColorMultMapRaining[index];
                rockWeatherState2 = index + 1 <= this.timeOfDayColorMultMapRaining.Count - 1 ? this.timeOfDayColorMultMapRaining[index + 1] : this.timeOfDayColorMultMapRaining[0];
                break;
            }
            float            num2 = Maths.NormalizeSection(RockWeather._timeOfDay, num1 * (float)index, num1 * (float)(index + 1));
            RockWeatherState rockWeatherState3 = new RockWeatherState();

            if (this._lastAppliedState == null)
            {
                this._lastAppliedState = rockWeatherState1.Copy();
            }
            if (lerp)
            {
                float amount = 1f / 1000f;
                rockWeatherState3.add           = Lerp.Vec3(this._lastAppliedState.add, rockWeatherState1.add + (rockWeatherState2.add - rockWeatherState1.add) * num2, amount);
                rockWeatherState3.multiply      = Lerp.Vec3(this._lastAppliedState.multiply, rockWeatherState1.multiply + (rockWeatherState2.multiply - rockWeatherState1.multiply) * num2, amount);
                rockWeatherState3.sky           = Lerp.Vec3(this._lastAppliedState.sky, rockWeatherState1.sky + (rockWeatherState2.sky - rockWeatherState1.sky) * num2, amount);
                rockWeatherState3.lightOpacity  = Lerp.Float(this._lastAppliedState.lightOpacity, rockWeatherState1.lightOpacity + (rockWeatherState2.lightOpacity - rockWeatherState1.lightOpacity) * num2, amount);
                rockWeatherState3.sunPos        = Lerp.Vec2(this._lastAppliedState.sunPos, rockWeatherState1.sunPos + (rockWeatherState2.sunPos - rockWeatherState1.sunPos) * num2, amount);
                rockWeatherState3.sunGlow       = Lerp.Float(this._lastAppliedState.sunGlow, rockWeatherState1.sunGlow + (rockWeatherState2.sunGlow - rockWeatherState1.sunGlow) * num2, amount);
                rockWeatherState3.sunOpacity    = Lerp.Float(this._lastAppliedState.sunOpacity, rockWeatherState1.sunOpacity + (rockWeatherState2.sunOpacity - rockWeatherState1.sunOpacity) * num2, amount);
                rockWeatherState3.rainbowLight  = Lerp.Float(this._lastAppliedState.rainbowLight, rockWeatherState1.rainbowLight + (rockWeatherState2.rainbowLight - rockWeatherState1.rainbowLight) * num2, amount);
                rockWeatherState3.rainbowLight2 = Lerp.Float(this._lastAppliedState.rainbowLight2, rockWeatherState1.rainbowLight2 + (rockWeatherState2.rainbowLight2 - rockWeatherState1.rainbowLight2) * num2, amount);
            }
            else
            {
                rockWeatherState3.add           = rockWeatherState1.add + (rockWeatherState2.add - rockWeatherState1.add) * num2;
                rockWeatherState3.multiply      = rockWeatherState1.multiply + (rockWeatherState2.multiply - rockWeatherState1.multiply) * num2;
                rockWeatherState3.sky           = rockWeatherState1.sky + (rockWeatherState2.sky - rockWeatherState1.sky) * num2;
                rockWeatherState3.lightOpacity  = rockWeatherState1.lightOpacity + (rockWeatherState2.lightOpacity - rockWeatherState1.lightOpacity) * num2;
                rockWeatherState3.sunPos        = rockWeatherState1.sunPos + (rockWeatherState2.sunPos - rockWeatherState1.sunPos) * num2;
                rockWeatherState3.sunGlow       = rockWeatherState1.sunGlow + (rockWeatherState2.sunGlow - rockWeatherState1.sunGlow) * num2;
                rockWeatherState3.sunOpacity    = rockWeatherState1.sunOpacity + (rockWeatherState2.sunOpacity - rockWeatherState1.sunOpacity) * num2;
                rockWeatherState3.rainbowLight  = rockWeatherState1.rainbowLight + (rockWeatherState2.rainbowLight - rockWeatherState1.rainbowLight) * num2;
                rockWeatherState3.rainbowLight2 = rockWeatherState1.rainbowLight2 + (rockWeatherState2.rainbowLight2 - rockWeatherState1.rainbowLight2) * num2;
            }
            this._lastAppliedState = rockWeatherState3;
            return(rockWeatherState3);
        }
Пример #7
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;
                                }
                            }
                        }
                    }
                }
            }
        }