public void Update()
 {
     if (this._done && !Level.current._waitingOnTransition)
     {
         Layer.doVirtualEffect = false;
         if (this._realBackground == null)
         {
             return;
         }
         Level.activeLevel.backgroundColor = this._realBackground.backgroundColor;
         this._realBackground.scissor      = new Rectangle(0.0f, 0.0f, (float)Graphics.width, (float)Graphics.height);
         this._realBackground = (BackgroundUpdater)null;
     }
     else
     {
         if (Level.current._waitingOnTransition)
         {
             this._realBackground = (BackgroundUpdater)null;
         }
         if (this._realBackground == null)
         {
             using (IEnumerator <Thing> enumerator = Level.activeLevel.things[typeof(BackgroundUpdater)].GetEnumerator())
             {
                 if (enumerator.MoveNext())
                 {
                     this._realBackground = (BackgroundUpdater)enumerator.Current;
                 }
             }
         }
         float num = this._stick;
         if (this._scanStage == 2 && this._virtualMode)
         {
             this._backgroundColor             = this._curBackgroundColor;
             Level.activeLevel.backgroundColor = Lerp.ColorSmooth(this._backgroundColor, this._curBackgroundColor, this._stick);
             Layer.Glow.fade = Lerp.FloatSmooth(Layer.Glow.fade, 0.0f, this._stick);
         }
         if (this._scanStage == 0 && !this._virtualMode && this._realBackground != null)
         {
             Level.activeLevel.backgroundColor = Lerp.ColorSmooth(this._backgroundColor, this._realBackground.backgroundColor, this._stick);
             Layer.Glow.fade = Lerp.FloatSmooth(Layer.Glow.fade, 1f, this._stick);
         }
         if (this._scanStage == -1)
         {
             Level.activeLevel.backgroundColor = Lerp.ColorSmooth(this._backgroundColor, Color.Black, 0.1f);
         }
         if (this._scanStage < 2)
         {
             num = 0.0f;
         }
         Rectangle rectangle1 = new Rectangle((float)(int)((1.0 - (double)num) * (double)Graphics.width), 0.0f, (float)(Graphics.width - (int)((1.0 - (double)num) * (double)Graphics.width)), (float)Graphics.height);
         if (this._realBackground != null)
         {
             if ((double)rectangle1.width == 0.0)
             {
                 this._realBackground.SetVisible(false);
             }
             else
             {
                 this._realBackground.scissor = rectangle1;
                 this._realBackground.SetVisible(true);
             }
         }
         Rectangle rectangle2 = new Rectangle(0.0f, 0.0f, (float)Graphics.width - rectangle1.width, (float)Graphics.height);
         if ((double)rectangle2.width == 0.0)
         {
             this.SetVisible(false);
             this._visible = false;
         }
         else
         {
             this._scissor = rectangle2;
             this.SetVisible(true);
             this._visible = true;
         }
         float amount1 = 0.04f;
         float amount2 = 0.06f;
         if (Level.activeLevel != null)
         {
             amount1 *= Level.activeLevel.transitionSpeedMultiplier;
             amount2 *= Level.activeLevel.transitionSpeedMultiplier;
         }
         if (!this._virtualMode)
         {
             if (this._scanStage == 0)
             {
                 this._stick = Lerp.Float(this._stick, 1f, amount1);
                 if ((double)this._stick > 0.990000009536743)
                 {
                     this._stick    = 1f;
                     this._incStage = true;
                 }
             }
             else if (this._scanStage == 1)
             {
                 this._stick = Lerp.Float(this._stick, 0.0f, amount1);
                 if ((double)this._stick < 0.00999999977648258)
                 {
                     this._stick    = 0.0f;
                     this._incStage = true;
                 }
             }
             else if (this._scanStage == 2)
             {
                 Layer.basicWireframeEffect.effect.Parameters["screenCross"].SetValue(0.0f);
                 if (Layer.basicWireframeTex)
                 {
                     Layer.basicWireframeEffect.effect.Parameters["scanMul"].SetValue(0.0f);
                 }
                 this._stick = Lerp.Float(this._stick, 1f, amount1);
                 if ((double)this._stick > 0.990000009536743)
                 {
                     this._stick    = 1f;
                     this._incStage = true;
                     this._done     = true;
                 }
             }
         }
         else if (this._scanStage == 2)
         {
             Layer.basicWireframeEffect.effect.Parameters["screenCross"].SetValue(0.0f);
             if (Layer.basicWireframeTex)
             {
                 Layer.basicWireframeEffect.effect.Parameters["scanMul"].SetValue(0.0f);
             }
             this._stick = Lerp.Float(this._stick, 0.0f, amount2);
             if ((double)this._stick < 0.00999999977648258)
             {
                 this._stick    = 0.0f;
                 this._decStage = true;
             }
         }
         else if (this._scanStage == 1)
         {
             this._stick = Lerp.Float(this._stick, 1f, amount2);
             if ((double)this._stick > 0.990000009536743)
             {
                 this._stick    = 1f;
                 this._decStage = true;
             }
         }
         else if (this._scanStage == 0)
         {
             this._stick = Lerp.Float(this._stick, 0.0f, amount2);
             if ((double)this._stick < 0.00999999977648258)
             {
                 this._stick    = 0.0f;
                 this._decStage = true;
                 this._done     = true;
             }
         }
         if (this._incStage)
         {
             this._incStage = false;
             ++this._scanStage;
         }
         if (this._decStage)
         {
             this._decStage = false;
             --this._scanStage;
         }
         if (this._scanStage < 2)
         {
             Layer.doVirtualEffect   = true;
             Layer.basicWireframeTex = this._scanStage == 1;
             Layer.basicWireframeEffect.effect.Parameters["screenCross"].SetValue(this._stick);
             if (Layer.basicWireframeTex)
             {
                 Layer.basicWireframeEffect.effect.Parameters["scanMul"].SetValue(1f);
             }
         }
         this._fullyVirtual    = false;
         this._fullyNonVirtual = false;
         if (this._scanStage == 3)
         {
             this._fullyNonVirtual = true;
         }
         else if (this._scanStage == -1)
         {
             this._fullyVirtual = true;
         }
         this._lastCameraX = Level.activeLevel.camera.centerX;
         if ((double)this._scissor.width == 0.0)
         {
             return;
         }
         this._parallax.scissor = this._scissor;
     }
 }