Ejemplo n.º 1
0
        //This loads your game file.
        public static FileData LoadGameFile(GameFile gameFile)
        {
            var path = FilePath(gameFile);

            if (File.Exists(path))
            {
                BinaryFormatter formatter = new BinaryFormatter();
                FileStream      stream    = new FileStream(path, FileMode.Open);
                FileData        data      = formatter.Deserialize(stream) as FileData;
                stream.Close();
                Debug.Log("Save File Loaded from " + path);
                return(data);
            }
            else
            {
                Debug.LogWarning("Save file not found in " + path);
                return(null);
            }
        }
Ejemplo n.º 2
0
 //This creates the name of the gamefile.
 //IT CAN BE NAMED ANYTHING AFTER THE FORWARD SLASH.
 public static string FilePath(GameFile gameFile)
 {
     return(Application.persistentDataPath + "/" + gameFile.gameData.fileNumber + ".save");
 }
Ejemplo n.º 3
0
 public FileData(GameFile gameFile)
 {
     gameData = gameFile.gameData;
 }