예제 #1
0
    public void SellItem(Item item)
    {
        m_audioSource.PlayOneShot(m_sellSound, 1.0f);
        m_items.Remove(item);

        //remove player stats if there are any
        if (item.hasStats)
        {
            m_playerController.RemoveItemStats(item.movementSpeedAmount, item.attackDamageAmount, item.attackSpeedAmount,
                                               item.healthAmount, item.manaAmount, item.manaRegenAmount, item.spellAmplificationAmount);
        }

        //If item sold is boots
        if (item.movementSpeedAmount != 0.0f)
        {
            m_playerHasBoots = false;
        }
        //If item sold is ankh
        if (item.itemCode == ItemCode.AnkhOfImmortality)
        {
            m_ankhOfImmortality = null;
        }

        //return 70% item cost
        GivePlayerGold((int)(item.cost * 0.7f));

        HUD_updateInventory?.Invoke();
    }
예제 #2
0
    public void ConsumeItem(Item item)
    {
        m_items.Remove(item);

        //remove player stats if there are any
        if (item.hasStats)
        {
            m_playerController.RemoveItemStats(item.movementSpeedAmount, item.attackDamageAmount, item.attackSpeedAmount,
                                               item.healthAmount, item.manaAmount, item.manaRegenAmount, item.spellAmplificationAmount);
        }

        HUD_updateInventory?.Invoke();
    }
예제 #3
0
    public void AddItem(Item item)
    {
        m_audioSource.PlayOneShot(m_purchaseSound, 1.0f);
        m_items.Add(item);

        //give player stats if there are any
        if (item.hasStats)
        {
            m_playerController.ApplyItemStats(item.movementSpeedAmount, item.attackDamageAmount, item.attackSpeedAmount,
                                              item.healthAmount, item.manaAmount, item.manaRegenAmount, item.spellAmplificationAmount);
        }

        HUD_updateInventory?.Invoke();
    }