Beispiel #1
0
    public void Save()
    {
        BinaryFormatter    bf   = new BinaryFormatter();
        FileStream         file = File.Create(Application.persistentDataPath + "/playerInfo.dat");
        PlayerData_Storage data = new PlayerData_Storage();

        data.currentCar = currentCar;

        bf.Serialize(file, data);
        file.Close();
    }
Beispiel #2
0
    public void Load()
    {
        if (File.Exists(Application.persistentDataPath + "/playerInfo.dat"))
        {
            BinaryFormatter    bf   = new BinaryFormatter();
            FileStream         file = File.Open(Application.persistentDataPath + "/playerInfo.dat", FileMode.Open);
            PlayerData_Storage data = (PlayerData_Storage)bf.Deserialize(file);

            currentCar = data.currentCar;

            file.Close();
        }
    }
    public void Save()
    {
        BinaryFormatter    bf   = new BinaryFormatter();
        FileStream         file = File.Create(Application.persistentDataPath + "/SaveInfo.ratoelho");
        PlayerData_Storage data = new PlayerData_Storage();

        data.GameLanguage   = GameLanguage;
        data.UnlockedStages = UnlockedStages;
        data.CurrentStage   = CurrentStage;
        data.S1Checkpoint   = S1Checkpoint;
        data.S2Checkpoint   = S2Checkpoint;
        data.Score          = Score;
        data.HighScore      = HighScore;
        data.S3Checkpoints  = S3Checkpoints;

        bf.Serialize(file, data);
        file.Close();
    }
    public void Load()
    {
        if (File.Exists(Application.persistentDataPath + "/SaveInfo.ratoelho"))
        {
            BinaryFormatter    bf   = new BinaryFormatter();
            FileStream         file = File.Open(Application.persistentDataPath + "/SaveInfo.ratoelho", FileMode.Open);
            PlayerData_Storage data = (PlayerData_Storage)bf.Deserialize(file);

            GameLanguage   = data.GameLanguage;
            UnlockedStages = data.UnlockedStages;
            CurrentStage   = data.CurrentStage;
            S1Checkpoint   = data.S1Checkpoint;
            S2Checkpoint   = data.S2Checkpoint;
            Score          = data.Score;
            HighScore      = data.HighScore;
            S3Checkpoints  = data.S3Checkpoints;

            file.Close();
        }
    }