private void SwitchToState(WilesBossState newState) { if (newState != null) { if (currentState != null) { currentState.OnEnd(this); } currentState = newState; currentState.OnStart(this); } }