Ejemplo n.º 1
0
    public bool RemoveItem(GameObject Slot)
    {
        bool Success = false;

        UI_EquipSlot SlotComponent = Slot.GetComponent <UI_EquipSlot>();

        if (SlotComponent)
        {
            SlotComponent.SetVisibility(Visiblility.Visible);
            SlotComponent.SetScale(new Vector2Int(1, 1));
            SlotComponent.SetIcon(null);
            SlotComponent.Item = new UI_Item();
            Success            = true;
            DebugLog("Item Removed Successfully: " + SlotComponent.Id);
        }

        return(Success);
    }
Ejemplo n.º 2
0
    public Vector2Int AddItem(UI_Item NewItem, GameObject Slot)
    {
        if (!ValidateItemFormat(NewItem))
        {
            return(InvalidIndex);
        }

        Vector2Int   Index         = InvalidIndex;
        UI_EquipSlot SlotComponent = Slot.GetComponent <UI_EquipSlot>();

        if (SlotComponent)
        {
            DebugLog("Item added to Equipament Slot: [" + SlotComponent.Id + "]");
            SlotComponent.SetVisibility(Visiblility.Visible);
            SlotComponent.SetIcon(NewItem.Icon);
            SlotComponent.SetScale(NewItem.Size);
            SlotComponent.Item = NewItem;
            Index = new Vector2Int(SlotComponent.Id, SlotComponent.Id);
        }

        return(Index);
    }