public bool LoadGame(SaveGameInfo saveGame) { while (UiSystems.InGameSelect.IsPicking) { UiSystems.InGameSelect.FreeCurrentPicker(); } Globals.GameLib.Reset(); UiSystems.Reset(); GameSystems.Player.PlayerObj_Destroy(); if (Globals.GameLib.LoadGame(saveGame)) { Globals.GameLib.ModuleName = saveGame.ModuleName; Stub.TODO("Calls to old MM UI were here"); // TODO return(true); } else { while (UiSystems.InGameSelect.IsPicking) { UiSystems.InGameSelect.FreeCurrentPicker(); } Globals.GameLib.Reset(); UiSystems.Reset(); return(false); } }
public static SaveGameInfo Read(string path) { if (!TryParseFilename(path, out var type, out var slotNumber)) { return(null); } var info = new SaveGameInfo(); info.Path = path; info.Type = type; info.Slot = slotNumber; info.LastModified = File.GetLastWriteTime(path); // Open the GSI File and read the metadata using var reader = new BinaryReader(new FileStream(path, FileMode.Open)); reader.ReadInt32(); // Unknown purpose info.ModuleName = reader.ReadPrefixedString(); info.LeaderName = reader.ReadPrefixedString(); info.MapId = reader.ReadInt32(); var days = reader.ReadInt32(); var milliseconds = reader.ReadInt32(); info.GameTime = new GameTime(days, milliseconds); info.LeaderPortrait = reader.ReadInt32(); info.LeaderLevel = reader.ReadInt32(); info.LeaderLoc = reader.ReadTileLocation(); reader.ReadInt32(); // Story state is unused in ToEE (Used in Arkanum) info.Name = reader.ReadPrefixedString(); var dirName = Path.GetDirectoryName(path); info.BasePath = type switch { SaveGameType.Normal => Path.Join(dirName, $"slot{slotNumber:D4}"), SaveGameType.QuickSave => Path.Join(dirName, "SlotQwik"), SaveGameType.AutoSave => Path.Join(dirName, "SlotAuto"), SaveGameType.IronMan => Path.Join(dirName, $"iron{slotNumber:D4}"), _ => throw new ArgumentOutOfRangeException() }; var smallScreenshotPath = info.BasePath + "s.jpg"; if (File.Exists(smallScreenshotPath)) { info.SmallScreenshotPath = smallScreenshotPath; } var largeScreenshotPath = info.BasePath + "l.jpg"; if (File.Exists(largeScreenshotPath)) { info.LargeScreenshotPath = largeScreenshotPath; } return(info); } }
// Start is called before the first frame update void Awake() { Debug.Log("entrei no awake"); if (SceneManager.GetActiveScene().name == "Start Menu") { saveInfo = SaveGameInfo.LoadInfo(saveCameraManager, saveItemManager.ResetScriptables(), saveInventoryManager.ResetScriptables(), savePuzzleManager.ResetScriptables()); } else if (saveInfo == null) { saveInfo = SaveGameInfo.LoadInfo(saveCameraManager, saveItemManager.ResetScriptables(), saveInventoryManager.ResetScriptables(), savePuzzleManager.ResetScriptables()); } if (SceneManager.GetActiveScene().name != "Start Menu") { savePositionManager.position.initialValue = saveInfo.savePosition; saveCameraManager.maxPositionMap.initialValue = saveInfo.maxPositionMap; saveCameraManager.minPositionMap.initialValue = saveInfo.minPositionMap; savePuzzleManager.LoadScriptables(saveInfo.savePuzzleManager); saveItemManager.LoadScriptables(saveInfo.saveItemManager); saveInventoryManager.LoadScriptables(saveInfo.saveInventoryManager); saveCameraManager.resetMaxPosition.initialValue = saveInfo.resetMaxPosition; saveCameraManager.resetMinPosition.initialValue = saveInfo.resetMinPosition; saveSoundConfigManager.LoadConfig(); } }
public void onClickedSave() { SaveGameInfo obj = new SaveGameInfo(); obj.test = "TestInformation"; obj.SerializeToXml("Test.xml"); }
private void OnApplicationQuit() { if (SceneManager.GetActiveScene().name != "Start Menu") { SaveGameInfo.SaveInfo(saveCameraManager, savePositionManager, saveItemManager.SaveScriptables(), saveInventoryManager.SaveScriptables(), savePuzzleManager.SaveScriptables()); saveSoundConfigManager.SaveConfig(); } }
public override void SetActualStats(SaveGameInfo stats, bool heal) { base.SetActualStats(stats, heal); foreach (WeaponInventory slot in weaponSlots) { slot.init(playerStats,false); } }
public static SaveGameInfo?ReadSaveFile(string file_name) { if (!GreenHellGame.Instance.m_RemoteStorage.FileExistsInRemoteStorage(file_name)) { return(null); } int fileSize = GreenHellGame.Instance.m_RemoteStorage.GetFileSize(file_name); byte[] array = new byte[fileSize]; if (GreenHellGame.Instance.m_RemoteStorage.FileRead(file_name, array, fileSize) == 0) { return(null); } BinaryFormatter binaryFormatter = new BinaryFormatter(); SaveGameInfo saveGameInfo = default(SaveGameInfo); saveGameInfo.file_name = file_name; MemoryStream memoryStream = new MemoryStream(array); GameVersion lhs = new GameVersion((GameVersion)binaryFormatter.Deserialize(memoryStream)); saveGameInfo.game_version = lhs; GameMode gameMode = (GameMode)binaryFormatter.Deserialize(memoryStream); saveGameInfo.game_mode = gameMode; long dateData = (long)binaryFormatter.Deserialize(memoryStream); saveGameInfo.date = DateTime.FromBinary(dateData); saveGameInfo.days_survived = (int)binaryFormatter.Deserialize(memoryStream) + 1; saveGameInfo.game_difficulty = (DifficultySettings.PresetType)binaryFormatter.Deserialize(memoryStream); saveGameInfo.tutorial = false; if (lhs >= GreenHellGame.s_GameVersionEarlyAccessUpdate8) { saveGameInfo.tutorial = (bool)binaryFormatter.Deserialize(memoryStream); } saveGameInfo.perma_death = (saveGameInfo.game_difficulty == DifficultySettings.PresetType.PermaDeath); if (lhs == GreenHellGame.s_GameVersionEarlyAccessUpdate12) { saveGameInfo.perma_death = (bool)binaryFormatter.Deserialize(memoryStream); } saveGameInfo.player_is_dead = false; if (lhs >= GreenHellGame.s_GameVersionEarlyAccessUpdate13) { saveGameInfo.player_is_dead = (bool)binaryFormatter.Deserialize(memoryStream); } try { if (lhs >= GreenHellGame.s_GameVersionMasterShelters1_3) { saveGameInfo.played_coop = (bool)binaryFormatter.Deserialize(memoryStream); } } catch { } saveGameInfo.loadable = (!saveGameInfo.perma_death || !saveGameInfo.player_is_dead); memoryStream.Close(); return(new SaveGameInfo?(saveGameInfo)); }
private void OnWebRpcResponse(WebRpcResponse response) { Debug.Log(string.Format("OnWebRpcResponse. Code: {0} Content: {1}", response.ReturnCode, SupportClass.DictionaryToString(response.Parameters))); if (response.ReturnCode == 0) { if (response.Parameters == null) { Debug.Log("WebRpc executed ok but didn't get content back. This happens for empty save-game lists."); memoryGui.GameListUpdate(); return; } if (response.Name.Equals("GetGameList")) { this.SavedGames.Clear(); // the response for GetGameList contains a Room's name as Key and another Dictionary<string,object> with the values the web service sends foreach (KeyValuePair <string, object> pair in response.Parameters) { // per key (room name), we send // "ActorNr" which is the PlayerId/ActorNumber this user had in the room // "Properties" which is another Dictionary<string,object> with the properties that the lobby sees Dictionary <string, object> roomValues = pair.Value as Dictionary <string, object>; SaveGameInfo si = new SaveGameInfo(); si.RoomName = pair.Key; si.DisplayName = pair.Key; // we might have a better display name for this room. see below. si.MyPlayerId = (int)roomValues["ActorNr"]; si.AvailableProperties = roomValues["Properties"] as Dictionary <string, object>; // let's find out of it's our turn to play and if we know the opponent's name (which we will display as game name). if (si.AvailableProperties != null) { // PropTurn is a value per room that gets set to the player who's turn is next. if (si.AvailableProperties.ContainsKey(PropTurn)) { int nextPlayer = (int)si.AvailableProperties[PropTurn]; si.MyTurn = nextPlayer == si.MyPlayerId; } // PropNames is set to a list of the player names. this can easily be turned into a name for the game to display if (si.AvailableProperties.ContainsKey(PropNames)) { string display = (string)si.AvailableProperties[PropNames]; display = display.ToLower(); display = display.Replace(this.PlayerName.ToLower(), ""); display = display.Replace(";", ""); si.DisplayName = "vs. " + display; } } //Debug.Log(si.ToStringFull()); this.SavedGames.Add(si); } memoryGui.GameListUpdate(); } } }
public void onClickedSave() { SaveGameInfo obj = new SaveGameInfo(); obj.Test = "TestInformation"; SharpSerializer sharpSerializer = new SharpSerializer(); sharpSerializer.Serialize(obj, "test.xml"); }
public void init(SaveGameInfo info,bool isPlayer) { playerStats = info; playerOwned = isPlayer; if(items[0] != null) { SetItemWithIndex(items[0], 0); } }
public void createBackup(SaveGameInfo saveGameInfo) { if (!Directory.Exists(SAVE_BACKUP_PATH)) { Directory.CreateDirectory(SAVE_BACKUP_PATH); } File.Copy(saveGameInfo.FilePath, SAVE_BACKUP_PATH + createBackupName(saveGameInfo)); }
public static SaveGameInfo?ReadSaveSlot(int slot_id) { SaveGameInfo?result = SaveGameInfo.ReadSaveFile(SaveGame.SLOT_NAME + slot_id.ToString() + ".sav"); if (result == null) { result = SaveGameInfo.ReadSaveFile(SaveGame.OLD_SLOT_NAME + slot_id.ToString() + ".sav"); } return(result); }
private void ListSaves() { //create "new save" entry { GameObject saveGO = Instantiate <GameObject>(SaveItemPrefab, ScrollContent); saveGO.GetComponent <Image>().color = new Color(0.9f, 0.9f, 0.9f); saveGO.GetComponentInChildren <Text>().text = Sub.Replace("NewSave", SubList); Button b = saveGO.GetComponent <Button>(); b.onClick.AddListener(delegate { OnSaveSelected(null, null, b); }); } string savePath = CoreParams.SavePath; DirectoryInfo saveDInfo = new DirectoryInfo(savePath); FileInfo[] savesFInfo = saveDInfo.GetFiles().OrderBy(f => f.CreationTime).Reverse().ToArray(); string overrideTheme = null; bool applyTheme = ApplyTheme; if (ApplyTheme) { var menuController = GetComponentInParent <BaseMenuController>(); overrideTheme = menuController.Ref()?.OverrideTheme; if (menuController) { applyTheme = menuController.ApplyTheme; } } foreach (FileInfo saveFI in savesFInfo) { try { SaveGameInfo saveInfo = new SaveGameInfo(saveFI); if (saveInfo.Type == SaveGameType.Auto || saveInfo.Type == SaveGameType.Quick) { continue; } GameObject saveGO = Instantiate <GameObject>(SaveItemPrefab, ScrollContent); saveGO.GetComponentInChildren <Text>().text = saveInfo.NiceName; Button b = saveGO.GetComponent <Button>(); b.onClick.AddListener(delegate { OnSaveSelected(Path.GetFileNameWithoutExtension(saveFI.Name), saveInfo, b); }); if (applyTheme) { ApplyThemeToElements(saveGO.transform, overrideTheme); } } catch (Exception e) { Debug.LogError("Failed to read save! " + saveFI.ToString(), this); Debug.LogException(e); } } }
public void LoadSavedShip() { string fileName = PlayerPrefs.GetString(LoadPannel.current); saveGameInfo = SaveGameSystem.LoadGame(fileName) as SaveGameInfo; if(saveGameInfo == null) { Debug.Log("Could not load player stats..."); saveGameInfo = new SaveGameInfo(); } loadShipFromSave.Load(); }
private void ListSaves() { string savePath = CoreParams.SavePath; DirectoryInfo saveDInfo = new DirectoryInfo(savePath); FileInfo[] savesFInfo = saveDInfo.GetFiles().OrderBy(f => f.CreationTime).Reverse().ToArray(); List <SaveGameInfo> allSaves = new List <SaveGameInfo>(savesFInfo.Length); //we don't go straight into the array in case of invalids... foreach (FileInfo saveFI in savesFInfo) { try { var save = new SaveGameInfo(saveFI); allSaves.Add(save); } catch (Exception e) { Debug.LogError("Failed to read save! " + saveFI.ToString(), this); Debug.LogException(e); } } Saves = allSaves.ToArray(); string overrideTheme = null; bool applyTheme = ApplyTheme; if (ApplyTheme) { var menuController = GetComponentInParent <BaseMenuController>(); overrideTheme = menuController.Ref()?.OverrideTheme; if (menuController) { applyTheme = menuController.ApplyTheme; } } //inefficient but probably safer for (int i = 0; i < Saves.Length; i++) { var save = Saves[i]; GameObject saveGO = Instantiate <GameObject>(SaveItemPrefab, ScrollContent); saveGO.GetComponentInChildren <Text>().text = save.NiceName; Button b = saveGO.GetComponent <Button>(); int lexI = i; b.onClick.AddListener(delegate { OnSaveSelected(lexI, b); }); //scoping is weird here if (applyTheme) { ApplyThemeToElements(saveGO.transform, overrideTheme); } } }
void loadSaveGame() { info = SaveGameSystem.LoadGame(saveGame + saveNumber) as SaveGameInfo; if (info == null) { Debug.Log("object was null"); // info = new SaveGameInfo(); //SaveSaveGame(); } // Debug.Log(info.primaryType); }
public override void Init(SaveGameInfo sgi, bool playerOwned) { base.Init(sgi, playerOwned); if (playerOwned) { layers = LayerMask.GetMask(new string[] { "enemy", "Neutral" }); } else { layers = LayerMask.GetMask(new string[] { "Neutral", "player" }); } }
private void FillSlots() { this.m_Slots.Clear(); for (int i = 0; i < LoadSaveGameMenuCommon.s_MaxSlots; i++) { SaveGameMenuSlot component = base.transform.FindDeepChild("Slot" + i.ToString()).GetComponent <SaveGameMenuSlot>(); DebugUtils.Assert(component, true); this.m_Slots.Add(component); } for (int j = 0; j < LoadSaveGameMenuCommon.s_MaxSlots; j++) { this.m_Slots[j].SetSaveInfo(SaveGameInfo.ReadSaveSlot(j)); } }
public static void mod_Autosave() { if (IEModOptions.SaveInterval != -1) { if (GameState.Mode.TrialOfIron) { GameState.TrialOfIronSave(); } else if (GameResources.SaveGame(SaveGameInfo.GetAutosaveFileName())) { GameResources.DeleteSavedGame(SaveGameInfo.GetOldAutosaveFileName()); } GameState instance = GameState.Instance; instance.AutosaveCycleNumber = instance.AutosaveCycleNumber + 1; } }
public static void Write(string path, SaveGameInfo info) { // Open the GSI File and read the metadata using var writer = new BinaryWriter(new FileStream(path, FileMode.Create)); writer.WriteInt32(0); // Unknown purpose (version most likely) writer.WritePrefixedString(info.ModuleName); writer.WritePrefixedString(info.LeaderName); writer.WriteInt32(info.MapId); writer.WriteGameTime(info.GameTime); writer.WriteInt32(info.LeaderPortrait); writer.WriteInt32(info.LeaderLevel); writer.WriteTileLocation(info.LeaderLoc); writer.WriteInt32(0); // Story state is unused in ToEE (Used in Arkanum) writer.WritePrefixedString(info.Name); }
public void SetSaveInfo(SaveGameInfo?save_info) { SaveGameInfo saveInfo; if (save_info != null) { this.m_SaveInfo = save_info.Value; GreenHellGame.Instance.GetLocalization(); this.m_Header.enabled = true; this.m_Text.enabled = true; this.m_Header.text = string.Empty; this.m_Text.text = string.Empty; Text header = this.m_Header; saveInfo = this.m_SaveInfo; header.text = saveInfo.GetInfoText(); Text text = this.m_Text; saveInfo = this.m_SaveInfo; text.text = saveInfo.date.ToString(); this.m_GameMode = this.m_SaveInfo.game_mode; this.m_Empty = false; this.SetupScreenshot(this.m_SaveInfo.file_name); if (this.m_SaveInfo.game_version < GreenHellGame.s_GameVersionReleaseCandidate) { this.m_SaveVersionInfo.enabled = true; this.m_SaveVersionInfo.text = this.m_SaveInfo.game_version.ToStringOfficial(); this.m_Header.color = this.m_SaveVersionInfo.color; } else { this.m_SaveVersionInfo.enabled = false; this.m_Header.color = this.m_InitialColor; } this.m_Coop.enabled = false; return; } saveInfo = default(SaveGameInfo); this.m_SaveInfo = saveInfo; this.m_Header.enabled = true; this.m_Text.enabled = false; this.m_Header.text = GreenHellGame.Instance.GetLocalization().Get("MenuSaveGameSlotEmpty", true); this.m_Empty = true; this.m_SaveVersionInfo.enabled = false; this.m_Header.color = this.m_InitialColor; this.m_Coop.enabled = false; }
private void UpdateContinueButton() { new SaveGameInfo?[4]; for (int i = 0; i < LoadSaveGameMenuCommon.s_MaxSlots; i++) { SaveGameInfo?lastSavedGameInfo = SaveGameInfo.ReadSaveSlot(i); if (lastSavedGameInfo != null && (this.m_LastSavedGameInfo == null || this.m_LastSavedGameInfo.Value.date < lastSavedGameInfo.Value.date)) { this.m_LastSavedGameInfo = lastSavedGameInfo; } } bool flag = this.m_LastSavedGameInfo != null && this.m_LastSavedGameInfo.Value.loadable && this.m_LastSavedGameInfo.Value.game_version >= GreenHellGame.s_GameVersionReleaseCandidate; this.m_Continue.gameObject.SetActive(flag); this.m_VLine.gameObject.SetActive(!flag); this.m_VLineWContinue.gameObject.SetActive(flag); this.m_ContinueSlot.SetActive(false); Text component = this.m_ContinueSlot.transform.FindDeepChild("Header").GetComponent <Text>(); string text; if (this.m_LastSavedGameInfo == null) { text = null; } else { SaveGameInfo valueOrDefault = this.m_LastSavedGameInfo.GetValueOrDefault(); text = valueOrDefault.GetInfoText(); } component.text = (text ?? ""); Text component2 = this.m_ContinueSlot.transform.FindDeepChild("Text").GetComponent <Text>(); string text2; if (this.m_LastSavedGameInfo == null) { text2 = null; } else { SaveGameInfo valueOrDefault = this.m_LastSavedGameInfo.GetValueOrDefault(); text2 = valueOrDefault.date.ToString(); } component2.text = (text2 ?? ""); }
public List <SaveGameInfo> ListSaveGames() { List <SaveGameInfo> retVal = new List <SaveGameInfo>(); if (Directory.Exists(SavePath)) { foreach (string Filename in Directory.GetFiles(SavePath, "*" + FileExtension)) { SaveGameInfo sg = new SaveGameInfo(); sg.Name = Path.GetFileNameWithoutExtension(Filename); sg.SaveDate = File.GetLastWriteTime(Filename); retVal.Add(sg); } } return(retVal); }
public void GameListUpdate() { Debug.Log(string.Format("GameListUpdate() Saved Games: {0}", this.GameClientInstance.SavedGames.Count)); for (int index = 0; index < this.LoadGameButtons.Length; index++) { GameObject loadGameButton = this.LoadGameButtons[index]; loadGameButton.SetActive(false); } if (this.GameClientInstance.SavedGames == null || this.GameClientInstance.SavedGames.Count == 0) { this.MainMenuInfo.Front.Text = string.Format("{0}\nno saves", this.GameClientInstance.PlayerName); this.MainMenuInfo.ToFront(); return; } this.MainMenuInfo.Front.Text = string.Format("{0}\n{1} saves", this.GameClientInstance.PlayerName, this.GameClientInstance.SavedGames.Count); this.MainMenuInfo.ToFront(); int saveGameCount = this.GameClientInstance.SavedGames.Count; int buttonNr = 0;// apply to button 0 and up int lastSaveGameBtn = this.LoadGameButtons.Length - 1; bool moreSavesThanButtons = (saveGameCount > this.LoadGameButtons.Length); for (int saveGameIndex = savegameListStartIndex; saveGameIndex < saveGameCount; saveGameIndex++) { if (buttonNr == lastSaveGameBtn && moreSavesThanButtons) { break; } SaveGameInfo saveGame = this.GameClientInstance.SavedGames[saveGameIndex]; // save to access this by index, as the for-loop only goes up to < saveGameCount this.ReapplyButton(this.LoadGameButtons[buttonNr++], saveGame.DisplayName + ((saveGame.MyTurn)?"\nyour turn":"\nwaiting"), "LoadGameMsg", new object[] { saveGame.RoomName, saveGame.MyPlayerId }); } if (moreSavesThanButtons) { this.ReapplyButton(this.LoadGameButtons[lastSaveGameBtn], ">>", "PageSaveGameListMsg", null); } }
private String createBackupName(SaveGameInfo saveGameInfo) { FileInfo fileInfo = new FileInfo(saveGameInfo.FilePath); return saveGameInfo.Name + "_" + DateTime.Now.ToString("MMddyyyyhhmmssfff") + SAVE_EXTENSION; }
private void OnWebRpcResponse(WebRpcResponse response) { Debug.Log(string.Format("OnWebRpcResponse. Code: {0} Content: {1}", response.ReturnCode, SupportClass.DictionaryToString(response.Parameters))); if (response.ReturnCode == 0) { if (response.Parameters == null) { Debug.Log("WebRpc executed ok but didn't get content back. This happens for empty save-game lists."); memoryGui.GameListUpdate(); return; } if (response.Name.Equals("GetGameList")) { this.SavedGames.Clear(); // the response for GetGameList contains a Room's name as Key and another Dictionary<string,object> with the values the web service sends foreach (KeyValuePair<string, object> pair in response.Parameters) { // per key (room name), we send // "ActorNr" which is the PlayerId/ActorNumber this user had in the room // "Properties" which is another Dictionary<string,object> with the properties that the lobby sees Dictionary<string, object> roomValues = pair.Value as Dictionary<string, object>; SaveGameInfo si = new SaveGameInfo(); si.RoomName = pair.Key; si.DisplayName = pair.Key; // we might have a better display name for this room. see below. si.MyPlayerId = (int)roomValues["ActorNr"]; si.AvailableProperties = roomValues["Properties"] as Dictionary<string, object>; // let's find out of it's our turn to play and if we know the opponent's name (which we will display as game name). if (si.AvailableProperties != null) { // PropTurn is a value per room that gets set to the player who's turn is next. if (si.AvailableProperties.ContainsKey(PropTurn)) { int nextPlayer = (int) si.AvailableProperties[PropTurn]; si.MyTurn = nextPlayer == si.MyPlayerId; } // PropNames is set to a list of the player names. this can easily be turned into a name for the game to display if (si.AvailableProperties.ContainsKey(PropNames)) { string display = (string)si.AvailableProperties[PropNames]; display = display.ToLower(); display = display.Replace(this.NickName.ToLower(), ""); display = display.Replace(";", ""); si.DisplayName = "vs. " + display; } } //Debug.Log(si.ToStringFull()); this.SavedGames.Add(si); } memoryGui.GameListUpdate(); } } }
// Use this for initialization void Awake() { saveGameInfo = new SaveGameInfo(); collider = GetComponent<BoxCollider2D>(); initColliderOffset = collider.offset; }
public void deleteSave(SaveGameInfo saveGameInfo) { File.Delete(saveGameInfo.FilePath); }
public String getDate(SaveGameInfo saveGameInfo) { FileInfo fileInfo = new FileInfo(saveGameInfo.FilePath); return fileInfo.LastWriteTime.ToString("MM/d/yyyy hh:mm:ss tt"); }
public virtual void SetActualStats(SaveGameInfo stats, bool heal) { if (stats == null) { Debug.LogError("Stats were null...."); return; } // Debug.Log("setting actual stats, player id is : " + stats.playerId ); playerStats = stats; maxHealth = PlayerStats.SetActualStat(PlayerStats.STATS.HEALTH, playerStats.HEALTH, baseHealth); armor = PlayerStats.SetActualStat(PlayerStats.STATS.ARMOR, playerStats.ARMOR, baseArmor); maxShield = PlayerStats.SetActualStat(PlayerStats.STATS.SHIELD, playerStats.SHIELD, baseMaxShield); energyRegen = PlayerStats.SetActualStat(PlayerStats.STATS.ENERGY_REGENERATION, playerStats.ENERGY_REGENERATION, baseEnergyRegen); maxEnergy = PlayerStats.SetActualStat(PlayerStats.STATS.ENERGY_CAPACITY, playerStats.ENERGY_CAPACITY, baseMaxEnergy); moveForce = PlayerStats.SetActualStat(PlayerStats.STATS.MOVE_SPEED, playerStats.MOVE_SPEED, baseMoveForce); maxSpeed = PlayerStats.SetActualStat(PlayerStats.STATS.MOVE_SPEED, playerStats.MOVE_SPEED, baseMaxSpeed); turnRate = PlayerStats.SetActualStat(PlayerStats.STATS.TURN_RATE, playerStats.TURN_RATE, baseTurnRate); if (heal) { currentHealth = maxHealth; currentShield = maxShield; currentEnergy = maxEnergy; } }
public void SetActualStats(SaveGameInfo stats, bool heal) { //Debug.Log("ship core not set up yet to load actual stats"); }
public String getSettlementName(SaveGameInfo saveGameInfo) { return new Regex("_[0-9]{17,}").Replace(saveGameInfo.Name, String.Empty); }
public void restoreBackup(SaveGameInfo saveGameInfo) { String savePath = SAVE_PATH + getSettlementName(saveGameInfo) + SAVE_EXTENSION; if (File.Exists(savePath)) { File.Delete(savePath); } if (File.Exists(saveGameInfo.FilePath)) { File.Copy(saveGameInfo.FilePath, savePath); } }
//public string[] items; // Use this for initialization void Start() { saveGameInfo = new SaveGameInfo(); }
public void ResetPosition() { saveInfo = SaveGameInfo.Reset(saveCameraManager, saveItemManager.ResetScriptables(), saveInventoryManager.ResetScriptables(), savePuzzleManager.ResetScriptables()); }
public void SaveGameInformation() { SaveGameInfo.SaveInfo(saveCameraManager, savePositionManager, saveItemManager.SaveScriptables(), saveInventoryManager.SaveScriptables(), savePuzzleManager.SaveScriptables()); saveSoundConfigManager.SaveConfig(); }