public override void Update()
 {
   base.Update();
   this._shakeInc += 0.8f;
   this._shakeMult = Lerp.Float(this._shakeMult, 0.0f, 0.05f);
   if (this._alternate == 0)
   {
     foreach (FluidStream hole in this._holes)
     {
       hole.onFire = this.onFire;
       hole.hSpeed = this.hSpeed;
       hole.vSpeed = this.vSpeed;
       hole.DoUpdate();
       hole.position = this.Offset(hole.offset);
       hole.sprayAngle = this.OffsetLocal(hole.startSprayAngle);
       float num1 = (float) (1.0 - ((double) hole.offset.y - (double) this.topLocal) / ((double) this.bottomLocal - (double) this.topLocal));
       if ((double) hole.x > (double) this.left - 2.0 && (double) hole.x < (double) this.right + 2.0 && (double) num1 < (double) this._fluidLevel)
       {
         float num2 = Maths.Clamp(this._fluidLevel - num1, 0.1f, 1f) * 0.0012f * hole.holeThickness;
         FluidData fluid = this._fluid;
         fluid.amount = num2;
         hole.Feed(fluid);
         this._fluidLevel -= num2;
       }
     }
   }
   this.weight = this._fluidLevel * 10f;
   ++this._alternate;
   if (this._alternate <= 4)
     return;
   this._alternate = 0;
 }
 public YellowBarrel(float xpos, float ypos)
     : base(xpos, ypos)
 {
     this.valid           = new EditorProperty <bool>(false, (Thing)this);
     this._maxHealth      = 15f;
     this._hitPoints      = 15f;
     this.graphic         = new Sprite("yellowBarrel");
     this.center          = new Vec2(7f, 8f);
     this._melting        = new Sprite("yellowBarrelMelting");
     this._toreUp         = new SpriteMap("yellowBarrelToreUp", 14, 12);
     this._toreUp.frame   = 1;
     this._toreUp.center  = new Vec2(0.0f, -8f);
     this.sequence        = new SequenceItem((Thing)this);
     this.sequence.type   = SequenceItemType.Goody;
     this.collisionOffset = new Vec2(-7f, -8f);
     this.collisionSize   = new Vec2(14f, 16f);
     this.depth           = new Depth(-0.1f);
     this._editorName     = "Barrel Y";
     this.thickness       = 4f;
     this.weight          = 5f;
     this.physicsMaterial = PhysicsMaterial.Metal;
     this.collideSounds.Add("barrelThud");
     this._holdOffset      = new Vec2(1f, 0.0f);
     this.flammable        = 0.3f;
     this._fluid           = Fluid.Gas;
     this.sequence.isValid = this.valid.value;
 }
Пример #3
0
 public override void Update()
 {
     if (!this._filled)
     {
         this._filled = true;
         Block b = Level.CheckRay <Block>(new Vec2(this.x, this.y), new Vec2(this.x, this.y + 64f));
         if (b != null)
         {
             FluidPuddle fluidPuddle = new FluidPuddle(this.x, b.top, b);
             Level.Add((Thing)fluidPuddle);
             float num = 0.0f;
             while ((double)fluidPuddle.CalculateDepth() < (double)((int)this.deep * 8))
             {
                 FluidData fluidType = this.GetFluidType();
                 fluidType.amount = 0.5f;
                 fluidPuddle.Feed(fluidType);
                 float depth = fluidPuddle.CalculateDepth();
                 if ((double)Math.Abs(num - depth) < 1.0 / 1000.0)
                 {
                     Level.Remove((Thing)this);
                     break;
                 }
                 num = depth;
             }
         }
     }
     base.Update();
 }
Пример #4
0
        public override void HeatUp(Vec2 location)
        {
            this._hitPoints -= 0.016f;
            if ((double)this._hitPoints < 0.0500000007450581)
            {
                Level.Remove((Thing)this);
                for (int index = 0; index < 16; ++index)
                {
                    FluidData water = Fluid.Water;
                    water.amount = 3f / 1000f;
                    Fluid fluid = new Fluid(this.x, this.y, Vec2.Zero, water);
                    fluid.hSpeed = (float)((double)index / 16.0 - 0.5) * Rando.Float(0.3f, 0.4f);
                    fluid.vSpeed = Rando.Float(-1.5f, 0.5f);
                    Level.Add((Thing)fluid);
                }
            }
            FluidData water1 = Fluid.Water;

            water1.amount = 0.004f;
            Fluid fluid1 = new Fluid(this.x, this.y, Vec2.Zero, water1);

            fluid1.hSpeed = Rando.Float(-0.1f, 0.1f);
            fluid1.vSpeed = Rando.Float(-0.3f, 0.3f);
            Level.Add((Thing)fluid1);
            base.HeatUp(location);
        }
 public WaterCooler(float xpos, float ypos)
   : base(xpos, ypos)
 {
   this._sprite = new SpriteMap("waterCoolerJug", 16, 16);
   this.graphic = (Sprite) this._sprite;
   this.center = new Vec2(8f, 8f);
   this.collisionOffset = new Vec2(-5f, -5f);
   this.collisionSize = new Vec2(10f, 10f);
   this.depth = new Depth(-0.5f);
   this._editorName = "Water Cooler";
   this.thickness = 2f;
   this.weight = 5f;
   this._jugLine = new SpriteMap("waterCoolerJugLine", 16, 16);
   this._jugLine.CenterOrigin();
   this.flammable = 0.3f;
   this._bottom = new Sprite("waterCoolerBottom");
   this._bottom.CenterOrigin();
   this.editorOffset = new Vec2(0.0f, -8f);
   this._fluid = Fluid.Water;
 }
 public override void Update()
 {
     base.Update();
     this.offDir = (sbyte)1;
     if ((double)this._hitPoints <= 0.0)
     {
         if (this.graphic != this._toreUp)
         {
             float     num1  = this._fluidLevel * 0.5f;
             float     num2  = this._fluidLevel * 0.5f;
             FluidData fluid = this._fluid;
             fluid.amount = num1 / 20f;
             for (int index = 0; index < 20; ++index)
             {
                 Level.Add((Thing) new Fluid(this.x + Rando.Float(-4f, 4f), this.y + Rando.Float(-4f, 4f), new Vec2(Rando.Float(-4f, 4f), Rando.Float(-4f, 0.0f)), fluid));
             }
             fluid.amount = num2;
             Level.Add((Thing) new Fluid(this.x, this.y - 8f, new Vec2(0.0f, -1f), fluid));
             Level.Add((Thing)SmallSmoke.New(this.x, this.y));
             SFX.Play("bulletHitWater");
             SFX.Play("crateDestroy");
         }
         this.graphic            = (Sprite)this._toreUp;
         this._onFire            = false;
         this.burnt              = 0.0f;
         this._weight            = 0.1f;
         this._collisionSize.y   = 8f;
         this._collisionOffset.y = -3f;
     }
     this.burnSpeed = 0.0015f;
     if (this._onFire && (double)this.burnt < 0.899999976158142)
     {
         if ((double)this.burnt > 0.300000011920929)
         {
             this.graphic = this._melting;
         }
         this.yscale             = (float)(0.5 + (1.0 - (double)this.burnt) * 0.5);
         this.centery            = (float)(8.0 - (double)this.burnt * 7.0);
         this._collisionOffset.y = (float)((double)this.burnt * 7.0 - 8.0);
         this._collisionSize.y   = (float)(16.0 - (double)this.burnt * 7.0);
     }
     if (!this._bottomHoles && (double)this.burnt > 0.600000023841858)
     {
         this._bottomHoles = true;
         this._holes.Add(new FluidStream(0.0f, 0.0f, new Vec2(-1f, -1f), 1f, new Vec2(-7f, 8f))
         {
             holeThickness = 2f
         });
         this._holes.Add(new FluidStream(0.0f, 0.0f, new Vec2(1f, -1f), 1f, new Vec2(7f, 8f))
         {
             holeThickness = 2f
         });
     }
     if (this._owner != null)
     {
         this.hSpeed = this.owner.hSpeed;
         this.vSpeed = this.owner.vSpeed;
     }
     if (this._alternate == 0)
     {
         foreach (FluidStream hole in this._holes)
         {
             hole.onFire = this.onFire;
             hole.hSpeed = this.hSpeed;
             hole.vSpeed = this.vSpeed;
             hole.DoUpdate();
             hole.position   = this.Offset(hole.offset);
             hole.sprayAngle = this.OffsetLocal(hole.startSprayAngle);
             float num1 = (float)(1.0 - ((double)hole.offset.y - (double)this.topLocal) / ((double)this.bottomLocal - (double)this.topLocal));
             if ((double)hole.x > (double)this.left - 2.0 && (double)hole.x < (double)this.right + 2.0 && (double)num1 < (double)this._fluidLevel)
             {
                 float     num2  = Maths.Clamp(this._fluidLevel - num1, 0.1f, 1f) * 0.008f * hole.holeThickness;
                 FluidData fluid = this._fluid;
                 fluid.amount = num2;
                 hole.Feed(fluid);
                 this._fluidLevel -= num2;
                 this._lossAccum  += num2;
                 while ((double)this._lossAccum > 0.0500000007450581)
                 {
                     this._lossAccum -= 0.05f;
                     if (this.sequence != null && this.sequence.isValid && ChallengeLevel.running)
                     {
                         ++ChallengeLevel.goodiesGot;
                         SFX.Play("tinyTick");
                     }
                 }
             }
         }
     }
     this.weight = this._fluidLevel * 10f;
     ++this._alternate;
     if (this._alternate <= 4)
     {
         return;
     }
     this._alternate = 0;
 }
Пример #7
0
        public override void Update()
        {
            ++this._framesSinceFeed;
            this.fluidWave += 0.1f;
            if ((double)this.data.amount < 9.99999974737875E-05)
            {
                Level.Remove((Thing)this);
            }
            if ((double)this.collisionSize.y > 10.0)
            {
                ++this.bubbleWait;
                if (this.bubbleWait > Rando.Int(15, 25))
                {
                    for (int index = 0; index < (int)Math.Floor((double)this.collisionSize.x / 16.0); ++index)
                    {
                        if ((double)Rando.Float(1f) > 0.850000023841858)
                        {
                            Level.Add((Thing) new TinyBubble(this.left + (float)(index * 16) + Rando.Float(-4f, 4f), this.bottom + Rando.Float(-4f), 0.0f, this.top + 10f));
                        }
                    }
                    this.bubbleWait = 0;
                }
                foreach (PhysicsObject physicsObject in Level.CheckRectAll <PhysicsObject>(this.topLeft, this.bottomRight))
                {
                    physicsObject.sleeping = false;
                }
            }
            FluidPuddle fluidPuddle = Level.CheckLine <FluidPuddle>(new Vec2(this.left, this.y), new Vec2(this.right, this.y), (Thing)this);

            if (fluidPuddle != null && (double)fluidPuddle.data.amount < (double)this.data.amount)
            {
                fluidPuddle.active = false;
                float num1 = Math.Min(fluidPuddle.left, this.left);
                float num2 = Math.Max(fluidPuddle.right, this.right);
                this.x = num1 + (float)(((double)num2 - (double)num1) / 2.0);
                this.Feed(fluidPuddle.data);
                Level.Remove((Thing)fluidPuddle);
            }
            if (this._leftStream != null)
            {
                this._leftStream.Update();
                this._leftStream.onFire = this.onFire;
            }
            if (this._rightStream != null)
            {
                this._rightStream.Update();
                this._rightStream.onFire = this.onFire;
            }
            float distance = this.FeedAmountToDistance(this.data.amount);

            if ((double)this._wide == 0.0)
            {
                this._wide = 1f / 1000f;
            }
            float num = Maths.Clamp(distance / this._wide, 1f, 99999f);

            if (this.onFire)
            {
                this._fireRise = Lerp.FloatSmooth(this._fireRise, 1f, 0.1f, 1.2f);
                if (this._framesSinceFeed > 10)
                {
                    FluidData data = this.data;
                    data.amount = -1f / 1000f;
                    this.Feed(data);
                    if ((double)this.data.amount <= 0.0)
                    {
                        this.data.amount = 0.0f;
                        this.alpha       = Lerp.Float(this.alpha, 0.0f, 0.04f);
                    }
                    else
                    {
                        this.alpha = Lerp.Float(this.alpha, 1f, 0.04f);
                    }
                    if ((double)this.alpha <= 0.0)
                    {
                        Level.Remove((Thing)this);
                    }
                }
            }
            else
            {
                this.alpha = Lerp.Float(this.alpha, 1f, 0.04f);
                if ((double)num < 3.0)
                {
                    FluidData data = this.data;
                    data.amount = -0.0001f;
                    this.Feed(data);
                }
            }
            float depth = this.CalculateDepth();

            if ((double)depth > 4.0 && !this._initializedUpperCorners)
            {
                this._initializedUpperCorners = true;
                foreach (BlockCorner groupCorner in this._block.GetGroupCorners())
                {
                    if (this._leftCorner != null && (double)groupCorner.corner.x == (double)this._leftCorner.corner.x && (double)groupCorner.corner.y < (double)this._leftCorner.corner.y)
                    {
                        if (this._topLeftCorner == null)
                        {
                            this._topLeftCorner = groupCorner;
                        }
                        else if ((double)groupCorner.corner.y > (double)this._topLeftCorner.corner.y)
                        {
                            this._topLeftCorner = groupCorner;
                        }
                    }
                    else if (this._rightCorner != null && (double)groupCorner.corner.x == (double)this._rightCorner.corner.x && (double)groupCorner.corner.y < (double)this._rightCorner.corner.y)
                    {
                        if (this._topRightCorner == null)
                        {
                            this._topRightCorner = groupCorner;
                        }
                        else if ((double)groupCorner.corner.y > (double)this._topRightCorner.corner.y)
                        {
                            this._topRightCorner = groupCorner;
                        }
                    }
                }
            }
            if (this._leftStream != null)
            {
                this._leftStream.position.y = this.y - this._collisionOffset.y;
            }
            if (this._rightStream != null)
            {
                this._rightStream.position.y = this.y - this._collisionOffset.y;
            }
            this._collisionOffset.y = -depth;
            this._collisionSize.y   = depth;
        }
Пример #8
0
        public void Feed(FluidData dat)
        {
            if (this._lava == null && dat.sprite != "" && dat.sprite != null)
            {
                if (this.data.sprite == null)
                {
                    this.data.sprite = dat.sprite;
                }
                this._lava = new SpriteMap(dat.sprite, 16, 16);
                this._lava.AddAnimation("idle", 0.1f, true, 0, 1, 2, 3);
                this._lava.SetAnimation("idle");
                this._lava.center   = new Vec2(8f, 10f);
                this._lavaAlternate = new SpriteMap(dat.sprite, 16, 16);
                this._lavaAlternate.AddAnimation("idle", 0.1f, true, 2, 3, 0, 1);
                this._lavaAlternate.SetAnimation("idle");
                this._lavaAlternate.center = new Vec2(8f, 10f);
            }
            if (this._lightRect == null && Layer.lighting)
            {
                this._lightRect = new WhiteRectangle(this.x, this.y, this.width, this.height, (double)dat.heat <= 0.0);
                Level.Add((Thing)this._lightRect);
            }
            if ((double)dat.amount > 0.0)
            {
                this._framesSinceFeed = 0;
            }
            this.data.Mix(dat);
            this.data.amount = Maths.Clamp(this.data.amount, 0.0f, this.MaxFluidFill());
            this._wide       = this.FeedAmountToDistance(this.data.amount);
            float num1 = this._wide + 4f;

            this._collisionOffset.x = (float)-((double)num1 / 2.0);
            this._collisionSize.x   = num1;
            this.FeedEdges();
            if (this._leftCorner != null && this._rightCorner != null && (double)this._wide > (double)this._rightCorner.corner.x - (double)this._leftCorner.corner.x)
            {
                this._wide = this._rightCorner.corner.x - this._leftCorner.corner.x;
                this.x     = this._leftCorner.corner.x + (float)(((double)this._rightCorner.corner.x - (double)this._leftCorner.corner.x) / 2.0);
            }
            float num2 = this._wide + 4f;

            this._collisionOffset.x = (float)-((double)num2 / 2.0);
            this._collisionSize.x   = num2;
            if (!(this.data.sprite == "water") || this._leftCorner == null)
            {
                return;
            }
            Block block = this._leftCorner.block;

            while (true)
            {
                switch (block)
                {
                case null:
                    goto label_19;

                case SnowTileset _:
                    if ((double)block.left + 2.0 > (double)this.left && (double)block.right - 2.0 < (double)this.right)
                    {
                        (block as SnowTileset).Freeze();
                        break;
                    }
                    break;

                case SnowIceTileset _:
                    if ((double)block.left + 2.0 > (double)this.left && (double)block.right - 2.0 < (double)this.right)
                    {
                        (block as SnowIceTileset).Freeze();
                        break;
                    }
                    break;
                }
                block = block.rightBlock;
            }
            label_19 :;
        }
Пример #9
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;
                                }
                            }
                        }
                    }
                }
            }
        }