/// <summary> /// Changes the state /// Calls exit on current state and enter of the new state is called. /// </summary> /// <param name="state"></param> public void ChangeState(IUpdateableState <TEntity> state) { if (state == null) { throw new NullReferenceException("state can not be null"); } if (CurrentState != null) { CurrentState.Exit(_owner); PreviousState = CurrentState; } CurrentState = state; CurrentState.Enter(_owner); }
/// <summary> /// Sets the current state. /// </summary> /// <param name="state"></param> public void SetCurrentState(IUpdateableState <TEntity> state) { CurrentState = state; }
/// <summary> /// Set the previous state. /// </summary> /// <param name="state"></param> public void SetPreviousState(IUpdateableState <TEntity> state) { PreviousState = state; }
/// <summary> /// Set global state. /// </summary> /// <param name="state"></param> public void SetGlobalState(IUpdateableState <TEntity> state) { GlobalState = state; }