public static void SaveFile() { SaveData data = new SaveData(); DataStorage.SaveFile(data); Objectives.SaveFile(data); BinaryFormatter binaryFormatter = new BinaryFormatter(); MemoryStream memoryStream = new MemoryStream(); binaryFormatter.Serialize(memoryStream, data); byte[] bytes = memoryStream.ToArray(); memoryStream.Dispose(); SaveLoad.AutoSaveGame(bytes, slotNumber, slotParams, controlFlags); }
void StartSaveLoad() { Main.Initialise(); SaveLoad.OnGameLoaded += OnSavedGameLoaded; SaveLoad.OnLoadError += OnLoadError; SaveLoad.OnLoadNoData += OnLoadNoData; SaveLoad.Initialise(); slotParams.title = "Gunhouse"; slotParams.subTitle = "Load your guns! Rain death from above!"; slotParams.detail = "Save Data"; slotParams.iconPath = Path.Combine(Application.streamingAssetsPath, "SaveIcon.png"); DataStorage.ResetValues(); Objectives.ResetValues(); }
public virtual void damage(float by, Gun.Ammo type) { if (hp <= 0) { return; } max_hp = max_hp == 0 ? hp : max_hp; float amt = (by * Gun.UpgradeMultiplier(type)); if (!Target.damages.ContainsKey(type)) { Target.damages[type] = 0; } Target.damages[type] += amt; hp -= amt; if (hp <= 0) { releaseOrphans(); for (int i = 0; i < skulls.Count; ++i) { skulls[i].explosion_timeout = 0; } frozen = 0; spiked = 0; startDying(); Game.instance.house.addScore((int)max_hp, position); remove = true; Game.instance.dead_group.add(this); Objectives.DefeatedWithAmmo(type); } if (flash_timeout <= 0) { flashing = House.flash_length; float health = hp / (float)max_hp; flash_timeout = (int)(health * House.flash_max_timeout + (1 - health) * House.flash_min_timeout); } }
void OnSavedGameLoaded(Messages.PluginMessage msg) { byte[] bytes = SaveLoad.GetLoadedGame(); if (bytes == null) { SceneManager.LoadSceneAsync((int)SceneIndex.Main); return; } SaveData data; using (MemoryStream memoryStream = new MemoryStream()) { BinaryFormatter binaryFormatter = new BinaryFormatter(); memoryStream.Write(bytes, 0, bytes.Length); memoryStream.Seek(0, SeekOrigin.Begin); data = (SaveData)binaryFormatter.Deserialize(memoryStream); } DataStorage.LoadFile(data); Objectives.LoadFile(data); SceneManager.LoadSceneAsync((int)SceneIndex.Main); }
public static void SaveEndWave() { Objectives.SaveFile(); DataStorage.SaveEndWave(); }
public static void SavePlayerData() { DataStorage.SaveFile(); Objectives.SaveFile(); }
public static void LoadPlayerData() { DataStorage.LoadFile(); Objectives.LoadFile(); }
public static void SaveEndWave() { Objectives.Save(); DataStorage.Save(); PlayerPrefs.Save(); }
public static void LoadPlayerData() { DataStorage.Load(); Objectives.Load(); PlayerPrefs.Save(); }
public static void DeleteFile() { SaveLoad.Delete(0, false); DataStorage.ResetValues(); Objectives.ResetValues(); }