public void SetStateAnyway(CharacterBaseState newState, CharacterBaseState nextState) { if (CurrentState != newState) { CurrentState.OnExit(); PreviousState = CurrentState; CurrentState = newState; CurrentState.NextState = nextState; OnStateChange(PreviousState, CurrentState); CurrentState.Initialize(); } }
public void SetStateOverride(CharacterBaseState newState) { if (CurrentState != newState) { if (CurrentState.CanBeOverriden) { CurrentState.OnExit(); PreviousState = CurrentState; CurrentState = newState; CurrentState.NextState = null; OnStateChange(PreviousState, CurrentState); CurrentState.Initialize(); } } }