public void Transition(GameStateCodes newStateCode) { if (transitionFunctionMappings.ContainsKey(newStateCode)) { TransitionFunc transitionFunc = transitionFunctionMappings[newStateCode]; transitionFunc(); } }
private void Dispatch(GameStateCodes newStateCode) { if (gameStateUpdateMappings.ContainsKey(newStateCode)) { gameStateCode = newStateCode; currentUpdateFunc = gameStateUpdateMappings[newStateCode]; stateTimeMsElapsed = 0; foreach (var observer in observers) { observer.Transition(newStateCode); } } }