Пример #1
0
        public void SwitchState(PawnState state)
        {
            LastState = CurrentState;

            if (LastState)
            {
                LastState.DoEnd();
            }
            CurrentState = state;
            if (CurrentState)
            {
                CurrentState.DoStart();
            }
        }
Пример #2
0
        public void SwitchState(PawnState state)
        {
            if (state == null)
            {
                return;
            }

            if (state != CurrentState)
            {
                LastState = CurrentState;
            }

            if (LastState)
            {
                LastState.DoEnd();
            }
            CurrentState = state;
            if (CurrentState)
            {
                CurrentState.DoStart();
            }
        }