private bool LoadFromFile() { ResetState(); SavedData sd = new SavedData(); bool success = SaveLoadSystem.LoadFromFile(ref sd, _profileFileName); if (SaveLoadSystem.LoadFromFile(ref sd.World.WorldControllerData.Tilemap, _worldFileName, SaveLoadSystem.EFormat.Txt) == false) { success = false; } if (success) { _worldManager.Load(sd.World); _player.Load(sd.Player); _infrastructure.Load(sd.Infrastructure); } else { Log.Write("Cannot load save state"); StartNewGame(); } return(success); }
public void SaveToFile() { SavedData sd = new SavedData() { Player = _player.RetrieveSerializableData(), Infrastructure = _infrastructure.RetrieveSerializableData(), World = _worldManager.RetrieveSerializableData() }; SaveLoadSystem.SaveToFile(sd, _profileFileName); SaveLoadSystem.SaveToFile(sd.World.WorldControllerData.Tilemap, _worldFileName, SaveLoadSystem.EFormat.Txt); }
private void RemoveSaveState() { SaveLoadSystem.RemoveFile(_profileFileName); SaveLoadSystem.RemoveFile(_worldFileName); }