Exemple #1
0
        public static void SaveUnlocks(UnlockManager unlock)
        {
            BinaryFormatter formatter = new BinaryFormatter();
            string          path      = Application.persistentDataPath + "/unlocks.save";
            FileStream      stream    = new FileStream(path, FileMode.Create);

            UnlockData data = new UnlockData(unlock);

            formatter.Serialize(stream, data);
            stream.Close();
        }
        public void LoadGame()
        {
            UnlockData unlock = SaveSystem.LoadUnlocks();

            u_sorter       = unlock.u_sorter;
            u_clayProducer = unlock.u_clayProducer;
            u_eyeMaker     = unlock.u_eyeMaker;
            u_mouthMaker   = unlock.u_mouthMaker;
            u_legMaker     = unlock.u_legMaker;
            u_armMaker     = unlock.u_armMaker;

            level = unlock.level;
        }
Exemple #3
0
        public static UnlockData LoadUnlocks()
        {
            string path = Application.persistentDataPath + "/unlocks.save";

            if (File.Exists(path))
            {
                BinaryFormatter formatter = new BinaryFormatter();
                FileStream      stream    = new FileStream(path, FileMode.Open);

                UnlockData data = formatter.Deserialize(stream) as UnlockData;
                stream.Close();

                return(data);
            }
            else
            {
                Debug.LogError("No file found at " + path);
                return(null);
            }
        }