StateSuper <T> mGlobalState; // FSM이 갱신될때마다 호출 public StateMachine(T mEntity) { this.mEntity = mEntity; this.mCurrentState = null; this.mPrevState = null; this.mGlobalState = null; }
// Change public void ChangeState(StateSuper <T> newState) { if (newState == null) { return; } if (mCurrentState != null) { mPrevState = mCurrentState; mCurrentState.Exit(mEntity); } mCurrentState = newState; mCurrentState.Enter(mEntity); }
public bool isSameState(StateSuper <T> state) { return((mCurrentState == state) ? true : false); }
public void SetGlobalState(StateSuper <T> t) { mGlobalState = t; }
public void SetPrevState(StateSuper <T> t) { mPrevState = t; }
// SetState public void SetCurrentState(StateSuper <T> t) { mCurrentState = t; }