Example #1
0
 public SaveFile(Position_Save positions, Player_save player, Backpack_Save backpack, Settings_save settings)
 {
     this.positions = positions;
     this.player    = player;
     this.backpack  = backpack;
     this.settings  = settings;
 }
Example #2
0
    public static SaveFile GetSaveFile(int SaveFile)
    {
        Position_Save positons = loadPostion("/checkpoint_SavePosition.test" + SaveFile.ToString());
        Player_save   player   = loadPlayerFile("/checkpoint_SavePlayer.test" + SaveFile.ToString());
        Backpack_Save backpack = loadBackpackFile("/checkpoint_BackpackSave.test" + SaveFile.ToString());
        Settings_save settings = LordSettings("/checkpoint_SettingsSave.test" + SaveFile.ToString());
        SaveFile      file     = new SaveFile(positons, player, backpack, settings);

        return(file);
    }
Example #3
0
    public static void SavePlayer(PlayerStats player, string savePostion)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Application.persistentDataPath + savePostion;
        FileStream      stream    = new FileStream(path, FileMode.Create);

        Player_save data = new Player_save(player);

        formatter.Serialize(stream, data);
        stream.Close();
    }
Example #4
0
 public void LoadPlayerBodies(AbilityFolder folder, Player_save _save)
 {
     playerBodies.Clear();
     currentBody = _save.currentBody;
     foreach (string _string in _save.Bodies)
     {
         foreach (PlayerBody _body in folder.playerBodies)
         {
             if (_body._name == _string)
             {
                 playerBodies.Add(_body);
                 break;
             }
         }
     }
 }
Example #5
0
    public static Player_save loadPlayerFile(string savePostion)
    {
        string path = Application.persistentDataPath + savePostion;

        if (File.Exists(path))
        {
            BinaryFormatter formatter = new BinaryFormatter();
            FileStream      stream    = new FileStream(path, FileMode.Open);
            Player_save     data      = formatter.Deserialize(stream) as Player_save;
            Debug.Log(path);
            stream.Close();
            return(data);
        }
        else
        {
            Debug.Log("what?");
            return(null);
        }
    }