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;
            }
        }
    }
示例#2
0
    public void OpenAfterCrateOpeningInterface()
    {
        PlayerEquipmentsDatas playerEquipmentsData = PlayerDataSaver.LoadPlayerEquipmentsDatas();

        //cratesParent.position = Vector3.SmoothDamp(cratesParent.position, cratesPositionWhenAllOpened.position, ref Vector3.zero, 1.5f);

        if (IntersceneManager.intersceneManager != null)
        {
            int numberOfTooMuchEquipments = playerLootManager.GetAllLootedEquipments.Count + playerEquipmentsData.GetPlayerEquipmentsInventory.Count - IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerInventoryCapacity;
            if (numberOfTooMuchEquipments > 0)
            {
                tooMuchLootButton.gameObject.SetActive(true);
                afterLootFinishedPanel.SetActive(false);
                tooMuchLootButton.SetButtonLabel("There's too much for us to carry. We have to throw " + numberOfTooMuchEquipments + " equipments.");
            }
            else
            {
                OpenReadyToContinuePanel();
            }
        }
        else
        {
            OpenReadyToContinuePanel();
        }
    }
    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);
        }
    }
示例#4
0
    public void OpenLootExchangePanel(List<ShipEquipment> lootEquipments)
    {
        hadToSort = true;

        equipmentsInformationsManager.SetUpForArena(ThrowSelectedObject);

        lootExchangePanel.gameObject.SetActive(true);

        PlayerEquipmentsDatas equipmentDatas = PlayerDataSaver.LoadPlayerEquipmentsDatas();
        playerInventory = equipmentDatas.GetPlayerEquipmentsInventory;

        lootedEquipments = lootEquipments;

        UpdateInterface();
    }
示例#5
0
    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);
    }
示例#6
0
    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 SetUpPlayerInventoryAndSet()
    {
        PlayerEquipmentsDatas playerEquipmentsDatas = PlayerDataSaver.LoadPlayerEquipmentsDatas();

        if (playerEquipmentsDatas != null)
        {
            IntersceneManager.intersceneManager.GetPlayerDatas.SetPlayerCurrentArmorValue(playerEquipmentsDatas.GetPlayerArmorAmount);
            IntersceneManager.intersceneManager.GetPlayerDatas.SetCurrentPlayerGoldAmount(playerEquipmentsDatas.GetPlayerGoldAmount);

            mapManager.ShipCompoManager.SetPlayerEquipmentsSet(playerEquipmentsDatas.GetPlayerEquipmentsSet);
            List <ShipEquipment> playerEquipmentsInventory = playerEquipmentsDatas.GetPlayerEquipmentsInventory;
            inventoryManager.SetPlayerEquipments(playerEquipmentsInventory);
            mapManager.UpdatePlayerEquipments();

            docksInterface.UpdatePlayerGoldText();

            ShipEquipmentHull hull = playerEquipmentsDatas.GetPlayerEquipmentsSet.GetHullEquipment as ShipEquipmentHull;
            if (hull != null)
            {
                //docksInterface.UpdatePlayerHullLifeText(hull.GetShipMaximumLife);
                docksInterface.UpdatePlayerHullArmorText(Mathf.Clamp(IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerCurrentArmorValue, 0, hull.GetShipMaximumArmor), hull.GetShipMaximumArmor);
            }
        }
    }
示例#8
0
    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)");
        }
    }