//----------------------------------------------------------------------------- // Player states //----------------------------------------------------------------------------- // Begin the given player state. public void BeginState(PlayerState newState) { if (state != newState) { if (state != null) { state.End(newState); } previousState = state; state = newState; state.Begin(this, previousState); } }
// Begin the given player state as a special state. public void BeginSpecialState(PlayerState newState) { if (specialState != null && !specialState.IsActive) { specialState = null; } if (specialState != newState) { if (specialState != null) { specialState.End(newState); } previousSpecialState = specialState; specialState = newState; specialState.Begin(this, previousSpecialState); } }
//----------------------------------------------------------------------------- // Player states //----------------------------------------------------------------------------- // Begin the given player state. public void BeginState(PlayerState newState) { if (state != newState) { if (state != null) { state.End(newState); } previousState = state; state = newState; newState.Begin(this, previousState); } }
// Begin the given player state as a special state. public void BeginSpecialState(PlayerState newState) { if (specialState != null && !specialState.IsActive) specialState = null; if (specialState != newState) { if (specialState != null) specialState.End(newState); previousSpecialState = specialState; specialState = newState; specialState.Begin(this, previousSpecialState); } }