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

        updateRep(rep);
        SetGameProgressionRepToPlayerPrefs(rep);
    }
Esempio 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());
    }
Esempio n. 3
0
    private static void SetGameProgressionRepToPlayerPrefs(GameProgressionRepresentation rep)
    {
        string json = JsonUtility.ToJson(rep);

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

        return(getRepField(rep));
    }