public static void UpdateGameProgression(Action <GameProgressionRepresentation> updateRep) { GameProgressionRepresentation rep = GetGameProgressionRepresentation(); updateRep(rep); SetGameProgressionRepToPlayerPrefs(rep); }
private static GameProgressionRepresentation GetGameProgressionRepresentation() { string stringRep = PlayerPrefs.GetString(GAME_PROGRESSION_KEY); GameProgressionRepresentation rep = JsonUtility.FromJson <GameProgressionRepresentation>(stringRep); return(rep != null ? rep : new GameProgressionRepresentation()); }
private static void SetGameProgressionRepToPlayerPrefs(GameProgressionRepresentation rep) { string json = JsonUtility.ToJson(rep); PlayerPrefs.SetString(GAME_PROGRESSION_KEY, json); }
public static float GetGameProgressionField(Func <GameProgressionRepresentation, float> getRepField) { GameProgressionRepresentation rep = GetGameProgressionRepresentation(); return(getRepField(rep)); }