public void ClosePanel() { PlayerDataTransfer.SavePlayerData(player); this.gameObject.SetActive(false); int availableSkillCount = player.knownSkills.Count; int equippedSkillCount = player.equippedSkills.Count; if (availableSkillCount != 0) { var skillSlots = availableSkillsList.GetComponentsInChildren <SkillSlot>(); foreach (var skill in skillSlots) { Destroy(skill.gameObject); } } if (equippedSkillCount != 0) { var skillSlots = equippedSkillsList.GetComponentsInChildren <SkillSlot>(); foreach (var skill in skillSlots) { Destroy(skill.gameObject); } } TownManager townManager = FindObjectOfType <TownManager>(); townManager.megaBossButton.gameObject.SetActive(true); townManager.normalBossButton.gameObject.SetActive(true); }
public void NextFight_Button() { //need to set up save/load data here PlayerDataTransfer.SavePlayerData(playerData); FightManager manager = FindObjectOfType <FightManager>(); manager.SavePlayerData(); SceneManager.LoadScene(2); }
public void ReturnToTown_Button() { //need to set up save/load data here PlayerDataTransfer.SavePlayerData(playerData); FightManager manager = FindObjectOfType <FightManager>(); manager.SavePlayerData(); levelUpIndicator.SetActive(false); SceneManager.LoadScene(1); }
private void CreateNewPlayer(string playerName) { PlayerDataUnit newPlayer = new PlayerDataUnit(); newPlayer.unitName = playerName; newPlayer.unitLevel = 1; newPlayer.unitPower = 10; newPlayer.maxHP = 50; newPlayer.unitIntelligence = 10; newPlayer.unitSpeed = 2; newPlayer.expToLevel = 50; newPlayer.currentExp = 0; newPlayer.availableStatPoints = 0; newPlayer.availableSkillPoints = 0; PlayerDataTransfer.SavePlayerData(newPlayer); }
public static bool LoadData() { if (File.Exists(filePath)) { SaveData save; PlayerDataUnit newPlayer = new PlayerDataUnit(); var binaryFormatter = new BinaryFormatter(); using (var fileStream = File.Open(filePath, FileMode.Open)) { save = (SaveData)binaryFormatter.Deserialize(fileStream); } newPlayer.unitName = save.SavedName; newPlayer.unitLevel = save.SavedLevel; newPlayer.maxHP = save.SavedHP; newPlayer.currentHP = save.SavedHP; newPlayer.unitIntelligence = save.SavedIntelligence; newPlayer.currentMP = save.SavedIntelligence; newPlayer.unitSpeed = save.SavedDex; newPlayer.availableStatPoints = save.SavedStatPoints; newPlayer.unitPower = save.SavedPower; newPlayer.expToLevel = save.SavedXpToLvl; newPlayer.availableSkillPoints = save.SavedSkillPoints; newPlayer.knownSkills = save.SavedKnownSkills; newPlayer.equippedSkills = save.SavedEquippedSkills; PlayerDataTransfer.SavePlayerData(newPlayer); Debug.Log("Data Loaded"); return(true); } else { Debug.LogWarning("Save file doesn't exist"); return(false); } }
public void SavePlayerData() { PlayerDataTransfer.SavePlayerData(playerUnit); }
private void SavePlayerData() { PlayerDataTransfer.SavePlayerData(player); }