protected override void Awake ()
	{
		base.Awake ();
		_stepStateExecutor = new StepState(this);
		_standStateExecutor = new StandState(this);
		_turningStateExecutor = new TurningState(this);
	}
		void OnPauseTurnOn()
		{
			if (HasPauseTurnOn)
			{
				if (TurningState == TurningState.TurningOn)
				{
					TurningState = TurningState.Paused;
					var turningOnState = StateBits.FirstOrDefault(x => x.StateBit == GKStateBit.TurningOn);
					if (turningOnState != null)
						SetStateBit(turningOnState.StateBit, false);
				}
			}
		}
		public void CheckDelays()
		{
			lock (locker)
			{
				if (TurningState == TurningState.TurningOn)
				{
					if (CurrentOnDelay == 0)
					{
						if (!IsMduOrBuz)
						{
							bool changed = SetStateBit(GKStateBit.TurningOn, false);
							changed = SetStateBit(GKStateBit.Off, false) || changed;
							changed = SetStateBit(GKStateBit.TurningOff, false) || changed;
							changed = SetStateBit(GKStateBit.On, true) || changed;
						}
						else
						{
							TurningState = TurningState.Holding;
							CurrentHoldDelay = HoldDelay;
						}
					}
					else
					{
						AdditionalShortParameters[0] = CurrentOnDelay;
						if (IsBush || IsMduOrBuz)
							AdditionalShortParameters[1] = 1;
						CurrentOnDelay--;
					}
				}
				if (TurningState == TurningState.Holding)
				{
					if (CurrentHoldDelay == 0)
					{
						if (IsMduOrBuz)
						{
							bool changed = SetStateBit(GKStateBit.TurningOn, false);
							changed = SetStateBit(GKStateBit.Off, false) || changed;
							changed = SetStateBit(GKStateBit.TurningOff, false) || changed;
							changed = SetStateBit(GKStateBit.On, true) || changed;
						}
						else
						{
							if (DelayRegime != null)
							{
								if (DelayRegime.Value == RubezhAPI.GK.DelayRegime.Off)
								{
									TurnOffNow();
								}
								if (DelayRegime.Value == RubezhAPI.GK.DelayRegime.On)
								{
									TurnOnNow();
								}
							}
						}
						TurningState = TurningState.None;
					}
					else
					{
						CurrentHoldDelay--;
						if (IsMduOrBuz)
							AdditionalShortParameters[1] = 2;
						AdditionalShortParameters[IsMduOrBuz ? 0 : 1] = CurrentHoldDelay;
					}
				}
				if (TurningState == TurningState.TurningOff)
				{
					if (CurrentOffDelay == 0)
					{
						var changed = SetStateBit(GKStateBit.On, false);
						changed = SetStateBit(GKStateBit.TurningOn, false) || changed;
						changed = SetStateBit(GKStateBit.TurningOff, false) || changed;
						changed = SetStateBit(GKStateBit.Off, true) || changed;
					}
					else
					{
						if (IsBush || IsMduOrBuz)
							AdditionalShortParameters[1] = 2;
						AdditionalShortParameters[GKBase is GKGuardZone || GKBase is GKDoor || IsBush || IsMduOrBuz ? 0 : 2] = CurrentOffDelay;
						CurrentOffDelay--;
					}
				}
				if (IsSettingGuardAlarm)
				{
					if (CurrentAlarmDelay == 0)
					{
						IsSettingGuardAlarm = false;
						SetStateBit(GKStateBit.Attention, false);
						SetStateBit(GKStateBit.Fire1, true);
					}
					else
					{
						AdditionalShortParameters[1] = CurrentAlarmDelay;
						CurrentAlarmDelay--;
					}
				}
			}
		}