Exemplo n.º 1
0
    public static void UpdateGameProgression(Action <GameProgressionRepresentation> updateRep)
    {
        GameProgressionRepresentation rep = GetGameProgressionRepresentation();

        updateRep(rep);
        SetGameProgressionRepToPlayerPrefs(rep);
    }
Exemplo n.º 2
0
    private static GameProgressionRepresentation GetGameProgressionRepresentation()
    {
        string stringRep = PlayerPrefs.GetString(GAME_PROGRESSION_KEY);
        GameProgressionRepresentation rep = JsonUtility.FromJson <GameProgressionRepresentation>(stringRep);

        return(rep != null ? rep : new GameProgressionRepresentation());
    }
Exemplo n.º 3
0
    private static void SetGameProgressionRepToPlayerPrefs(GameProgressionRepresentation rep)
    {
        string json = JsonUtility.ToJson(rep);

        PlayerPrefs.SetString(GAME_PROGRESSION_KEY, json);
    }
Exemplo n.º 4
0
    public static float GetGameProgressionField(Func <GameProgressionRepresentation, float> getRepField)
    {
        GameProgressionRepresentation rep = GetGameProgressionRepresentation();

        return(getRepField(rep));
    }