public void UpdateTick() { if (_currentState != null) { var next = _currentState.ShoudExit(); if (next != null && next != _currentState.GetType()) { _currentState.OnExit(); _currentState = _fsmStates[next]; _currentState.OnEnter(); } _currentState.OnUpdate(); } }