private IEnumerator ChangeStateCoroutine(string stateName, object context) { // Exit previous state if (currentState != null) { currentState.StateObj.StateExit(); } while (isAsync) { yield return(null); } // Set new state currentState = sceneStateTable.Find((s) => { return(s.StateName == stateName); }); if (currentState == null) { Debug.LogError("SceneStateManager :: not found StateName."); yield break; } // Start new state currentState.StateObj.StateStart(context); stateChanging = false; }
public void InitState() { // Initial state SceneStateData state = sceneStateTable.Find((s) => { return(s.AsInitial); }); if (state == null) { state = sceneStateTable[0]; } ChangeState(state.StateName); }