public void ChangeState(CameraState newState) { if (currentState != null) { currentState.Exit(); } currentState = newState; currentState.Enter(); }
public void setState(string stateName) { if (stateDic.ContainsKey(stateName) == false) { return; } CameraState aimState = stateDic[stateName]; if (currentState != null)//currentMode != aimMode//新旧状态可以相同 { Debug.Log(currentState.GetType().Name + " Exit()"); currentState.Exit(); } currentState = aimState; Debug.Log(aimState.GetType().Name + " Enter()"); aimState.Enter(); }
public void ChangeState(CameraState newState) { CurrentState.Exit(); CurrentState = newState; CurrentState.Enter(); }
public void Initialize(CameraState startingState) { CurrentState = startingState; CurrentState.Enter(); }