private void Reducer(HazardAction action) { switch (action.GetType().ToString()) { case "UpdatePlayerInsideCountAction": _playerInsideCount += (((UpdatePlayerInsideCountAction)action).playerCountChange); break; default: Debug.Log("no type of action"); // don't change internal state break; } }
public void Dispatch(HazardAction action) { Reducer(action); ComputeState(); }