public void CheckForSaveFiles() { PlayerEquipmentsDatas equipmentsData = PlayerDataSaver.LoadPlayerEquipmentsDatas(); if (equipmentsData == null) { Debug.Log("Pas de fichier d'équipements, application des équipements de base"); equipmentsData = new PlayerEquipmentsDatas(); equipmentsData.SetPlayerEquipmentsData(gameBeginningEquipmentSet, new List <ShipEquipment>(), 10, 0); PlayerDataSaver.SavePlayerEquipmentsDatas(equipmentsData); IntersceneManager.intersceneManager.GetPlayerDatas.SetEquipedEquipements(gameBeginningEquipmentSet); } else { IntersceneManager.intersceneManager.GetPlayerDatas.SetEquipedEquipements(equipmentsData.GetPlayerEquipmentsSet); } PlayerProgressionDatas progressionData = PlayerDataSaver.LoadProgressionDatas(); if (progressionData == null) { Debug.Log("Pas de fichier de progression"); PlayerDataSaver.SavePlayerProgressionDatas(new List <PassedArenaData>(), false); } else { if (progressionData.GetPassedTuto) { passedTutorial = true; } } }
public void UpdateArmorAmountAndLifeInterface() { ShipEquipmentHull hullEquip = EquipedEquipments.GetHullEquipment as ShipEquipmentHull; if (hullEquip != null) { relatedShip.LfManager.SetUpArmorAndLife(hullEquip.GetShipMaximumLife, Mathf.Clamp(IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerCurrentArmorValue, 0, hullEquip.GetShipMaximumArmor), hullEquip.GetShipMaximumArmor); relatedShip.PlrInterface.SetLifeBar(hullEquip.GetShipMaximumLife, Mathf.Clamp(IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerCurrentArmorValue, 0, hullEquip.GetShipMaximumArmor), hullEquip.GetShipMaximumArmor); PlayerEquipmentsDatas equipmentsData = PlayerDataSaver.LoadPlayerEquipmentsDatas(); equipmentsData.SetPlayerArmorAmount(relatedShip.LfManager.GetCurrentArmorAmount); equipmentsData.SetPlayerGoldAmount(IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerGoldAmount); PlayerDataSaver.SavePlayerEquipmentsDatas(equipmentsData); } }
public void LootCrate() { LootPopUpObject lootPopUpObject = GameManager.gameManager.PoolManager.GetLootPopUp(LootPopUpPoolTag.Normal, PoolInteractionType.GetFromPool); lootPopUpObject.transform.position = transform.position; if (lootedEquipment != null) { lootingPlayer.PlayerLootManager.AddLootedEquipment(lootedEquipment); lootPopUpObject.SetUp(transform.position, lootedEquipment.GetEquipmentInformations.GetEquipmentIcon); } if (ArenaManager.arenaManager != null) { if (lootedGold != 0) { lootingPlayer.PlayerLootManager.AddLootedGold(lootedGold); lootPopUpObject.SetUp(transform.position, lootedGold); } ArenaManager.arenaManager.DropManager.RemoveDropCrate(this); } else { if (IntersceneManager.intersceneManager != null) { IntersceneManager.intersceneManager.GetPlayerDatas.EarnMoney(lootedGold); PlayerEquipmentsDatas data = PlayerDataSaver.LoadPlayerEquipmentsDatas(); data.SetPlayerGoldAmount(IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerGoldAmount); PlayerDataSaver.SavePlayerEquipmentsDatas(data); lootPopUpObject.SetUp(transform.position, lootedGold); } } gameObject.SetActive(false); GameManager.gameManager.PoolManager.ReturnLootCrate(this); }
public void Restart() { /*if (!restarting) * {*/ PlayerEquipmentsDatas equipmentsData = PlayerDataSaver.LoadPlayerEquipmentsDatas(); if (equipmentsData == null) { equipmentsData = new PlayerEquipmentsDatas(); equipmentsData.SetPlayerEquipmentsData(new EquipmentsSet(), new List <ShipEquipment>(), player.LfManager.GetCurrentArmorAmount, IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerGoldAmount); } else { equipmentsData.SetPlayerArmorAmount(player.LfManager.GetCurrentArmorAmount); equipmentsData.SetPlayerGoldAmount(IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerGoldAmount); } IntersceneManager.intersceneManager.GetPlayerDatas.SetPlayerCurrentArmorValue(player.LfManager.GetCurrentArmorAmount); PlayerDataSaver.SavePlayerEquipmentsDatas(equipmentsData); SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().buildIndex); //restarting = true; //} }
public void GoBackToMap() { /*if (backingToMap) * return;*/ if (IntersceneManager.intersceneManager == null) { Debug.LogWarning("Attention : il n'y a pas d'IntersceneManager actuellement, impossible de retourner sur la map"); } string menuSceneName = IntersceneManager.intersceneManager.MapInterscInformations.GetMapSceneName; string specialSceneName = IntersceneManager.intersceneManager.MapInterscInformations.GetSpecialSceneToLoadName; try { PlayerEquipmentsDatas equipmentsData = PlayerDataSaver.LoadPlayerEquipmentsDatas(); if (equipmentsData == null) { equipmentsData = new PlayerEquipmentsDatas(); List <ShipEquipment> playerInventoryEquipments = new List <ShipEquipment>(); if (equipmentLootExchangeManager.HadToSort) { foreach (ShipEquipment equip in equipmentLootExchangeManager.GetPlayerModifiedLoot) { playerInventoryEquipments.Add(equip); } } else { foreach (ShipEquipment equip in player.PlayerLootManager.GetAllLootedEquipments) { playerInventoryEquipments.Add(equip); } } equipmentsData.SetPlayerEquipmentsData(new EquipmentsSet(), playerInventoryEquipments, player.LfManager.GetCurrentArmorAmount, IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerGoldAmount); } else { equipmentsData.SetPlayerArmorAmount(player.LfManager.GetCurrentArmorAmount); equipmentsData.SetPlayerGoldAmount(IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerGoldAmount); List <ShipEquipment> playerInventoryEquipments = new List <ShipEquipment>(); if (equipmentLootExchangeManager.HadToSort) { foreach (ShipEquipment equip in equipmentLootExchangeManager.GetPlayerModifiedInventory) { playerInventoryEquipments.Add(equip); } foreach (ShipEquipment equip in equipmentLootExchangeManager.GetPlayerModifiedLoot) { playerInventoryEquipments.Add(equip); } } else { playerInventoryEquipments = equipmentsData.GetPlayerEquipmentsInventory; foreach (ShipEquipment equip in player.PlayerLootManager.GetAllLootedEquipments) { playerInventoryEquipments.Add(equip); } } equipmentsData.SetPlayerInventory(playerInventoryEquipments); } PlayerDataSaver.SavePlayerEquipmentsDatas(equipmentsData); if (specialSceneName != null && specialSceneName != "" && Won) { IntersceneManager.intersceneManager.MapInterscInformations.ResetSpecialScene(); SceneManager.LoadSceneAsync(specialSceneName); } else { SceneManager.LoadSceneAsync(menuSceneName); } //backingToMap = true; } catch { Debug.LogWarning("Attention : le nom de scène n'a pas été assigné sur l'interscene manager, ou la scene n'existe pas (ou n'as pas été buildée)"); } }
public void SavePlayerDatas() { PlayerDataSaver.SavePlayerEquipmentsDatas(shipCompositionManager.ComposeEquipmentSet(), mapDocksManager.InvtrManager.GetPlayerInventoryEquipments, IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerCurrentArmorValue, IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerGoldAmount); }