public void SwitchStateTo(GamefieldState newState) { // Debug.Log("Old state: "+_currentState); if (_currentState != null) { _currentState.OnExit(); } _currentState = newState; // Debug.Log("Switch to: " + _currentState); _currentState.OnEnter(); }
public void StartGame(SerializedLevel level = null) { LastLoadedLevel = level; _currentState = new InitState(this); _currentState.OnEnter(); }
public void SwitchStateTo(GamefieldState newState) { _currentState.OnExit(); _currentState = newState; Debug.Log("Switch to: " + _currentState); _currentState.OnEnter(); }