public void ReturnLootPopUp(LootPopUpObject lootPopUp)
    {
        if (!lootPopUpPoolsDictionary.ContainsKey(lootPopUp.GetPopUpPoolTag))
        {
            return;
        }

        lootPopUpPoolsDictionary[lootPopUp.GetPopUpPoolTag].AddObjectInPool(lootPopUp);
    }
Example #2
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);
    }