예제 #1
0
    public void EquipItem(Item itemToReplace, int itemAreaPlayerId)
    {
        if (SelectedItem != null)
        {
            if (SelectedItem.Owner.Id == itemAreaPlayerId)
            {
                if (!SelectedItem.Owner.Hero.EquippedItems.Select(x => x.Id).Contains(SelectedItem.Id) || (itemToReplace != null && itemToReplace.Id == SelectedItem.Id))
                {
                    if (itemToReplace != null)
                    {
                        itemToReplace.DestroyItem();
                    }

                    if (SelectedCard != null)
                    {
                        SelectedCard.Play();
                    }
                    else
                    {
                        SelectedItem.Equip();
                    }

                    SelectedItem = null;
                    GameManager.instance.uiManager.RefreshUI();
                    RefreshEffectManager();
                }
            }
        }
    }