private void OnCellChange()
 {
     if (!base.gameObject.HasTag(GameTags.Dead))
     {
         int num = Grid.PosToCell(this);
         if (Grid.IsValidCell(num))
         {
             if (!Grid.Revealed[num])
             {
                 Grid.PosToXY(base.transform.GetPosition(), out int x, out int y);
                 Reveal(x, y, radius, innerRadius);
                 Grid.Revealed[num] = true;
             }
             FogOfWarMask.ClearMask(num);
         }
     }
 }
 public override void InitializeStates(out BaseState default_state)
 {
     base.serializable = true;
     default_state     = closed;
     root.Update("RefreshIsBlocked", delegate(Instance smi, float dt)
     {
         smi.RefreshIsBlocked();
     }, UpdateRate.SIM_200ms, false).ParamTransition(isSealed, Sealed.closed, GameStateMachine <Controller, Instance, Door, object> .IsTrue);
     closeblocked.PlayAnim("open").ParamTransition(isOpen, open, GameStateMachine <Controller, Instance, Door, object> .IsTrue).ParamTransition(isBlocked, closedelay, GameStateMachine <Controller, Instance, Door, object> .IsFalse);
     closedelay.PlayAnim("open").ScheduleGoTo(0.5f, closing).ParamTransition(isOpen, open, GameStateMachine <Controller, Instance, Door, object> .IsTrue)
     .ParamTransition(isBlocked, closeblocked, GameStateMachine <Controller, Instance, Door, object> .IsTrue);
     closing.ParamTransition(isBlocked, closeblocked, GameStateMachine <Controller, Instance, Door, object> .IsTrue).ToggleTag(GameTags.Transition).ToggleLoopingSound("Closing loop", (Instance smi) => smi.master.doorClosingSound, (Instance smi) => !string.IsNullOrEmpty(smi.master.doorClosingSound))
     .Enter("SetParams", delegate(Instance smi)
     {
         smi.master.UpdateAnimAndSoundParams(smi.master.on);
     })
     .Update(delegate(Instance smi, float dt)
     {
         if (smi.master.doorClosingSound != null)
         {
             smi.master.loopingSounds.UpdateSecondParameter(smi.master.doorClosingSound, SOUND_PROGRESS_PARAMETER, smi.Get <KBatchedAnimController>().GetPositionPercent());
         }
     }, UpdateRate.SIM_33ms, false)
     .Enter("SetActive", delegate(Instance smi)
     {
         smi.master.SetActive(true);
     })
     .Exit("SetActive", delegate(Instance smi)
     {
         smi.master.SetActive(false);
     })
     .PlayAnim("closing")
     .OnAnimQueueComplete(closed);
     open.PlayAnim("open").ParamTransition(isOpen, closeblocked, GameStateMachine <Controller, Instance, Door, object> .IsFalse).Enter("SetWorldStateOpen", delegate(Instance smi)
     {
         smi.master.SetWorldState();
     });
     closed.PlayAnim("closed").ParamTransition(isOpen, opening, GameStateMachine <Controller, Instance, Door, object> .IsTrue).ParamTransition(isLocked, locking, GameStateMachine <Controller, Instance, Door, object> .IsTrue)
     .Enter("SetWorldStateClosed", delegate(Instance smi)
     {
         smi.master.SetWorldState();
     });
     locking.PlayAnim("locked_pre").OnAnimQueueComplete(locked).Enter("SetWorldStateClosed", delegate(Instance smi)
     {
         smi.master.SetWorldState();
     });
     locked.PlayAnim("locked").ParamTransition(isLocked, unlocking, GameStateMachine <Controller, Instance, Door, object> .IsFalse);
     unlocking.PlayAnim("locked_pst").OnAnimQueueComplete(closed);
     opening.ToggleTag(GameTags.Transition).ToggleLoopingSound("Opening loop", (Instance smi) => smi.master.doorOpeningSound, (Instance smi) => !string.IsNullOrEmpty(smi.master.doorOpeningSound)).Enter("SetParams", delegate(Instance smi)
     {
         smi.master.UpdateAnimAndSoundParams(smi.master.on);
     })
     .Update(delegate(Instance smi, float dt)
     {
         if (smi.master.doorOpeningSound != null)
         {
             smi.master.loopingSounds.UpdateSecondParameter(smi.master.doorOpeningSound, SOUND_PROGRESS_PARAMETER, smi.Get <KBatchedAnimController>().GetPositionPercent());
         }
     }, UpdateRate.SIM_33ms, false)
     .Enter("SetActive", delegate(Instance smi)
     {
         smi.master.SetActive(true);
     })
     .Exit("SetActive", delegate(Instance smi)
     {
         smi.master.SetActive(false);
     })
     .PlayAnim("opening")
     .OnAnimQueueComplete(open);
     Sealed.Enter(delegate(Instance smi)
     {
         OccupyArea component = smi.master.GetComponent <OccupyArea>();
         for (int i = 0; i < component.OccupiedCellsOffsets.Length; i++)
         {
             Grid.PreventFogOfWarReveal[Grid.OffsetCell(Grid.PosToCell(smi.master.gameObject), component.OccupiedCellsOffsets[i])] = false;
         }
         smi.sm.isLocked.Set(true, smi);
         smi.master.controlState = ControlState.Locked;
         smi.master.RefreshControlState();
         if (smi.master.GetComponent <Unsealable>().facingRight)
         {
             KBatchedAnimController component2 = smi.master.GetComponent <KBatchedAnimController>();
             component2.FlipX = true;
         }
     }).Enter("SetWorldStateClosed", delegate(Instance smi)
     {
         smi.master.SetWorldState();
     }).Exit(delegate(Instance smi)
     {
         smi.sm.isLocked.Set(false, smi);
         smi.master.GetComponent <AccessControl>().controlEnabled = true;
         smi.master.controlState = ControlState.Opened;
         smi.master.RefreshControlState();
         smi.sm.isOpen.Set(true, smi);
         smi.sm.isLocked.Set(false, smi);
         smi.sm.isSealed.Set(false, smi);
     });
     Sealed.closed.PlayAnim("sealed", KAnim.PlayMode.Once);
     Sealed.awaiting_unlock.ToggleChore((Instance smi) => CreateUnsealChore(smi, true), Sealed.chore_pst);
     Sealed.chore_pst.Enter(delegate(Instance smi)
     {
         smi.master.hasBeenUnsealed = true;
         if (smi.master.GetComponent <Unsealable>().unsealed)
         {
             smi.GoTo(opening);
             FogOfWarMask.ClearMask(Grid.CellRight(Grid.PosToCell(smi.master.gameObject)));
             FogOfWarMask.ClearMask(Grid.CellLeft(Grid.PosToCell(smi.master.gameObject)));
         }
         else
         {
             smi.GoTo(Sealed.closed);
         }
     });
 }