예제 #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();
            }
        }