public bool CheckItemFit(GameObject item)
        {
            ItemAttributes attributes = item.GetComponent <ItemAttributes>();

            if (!allowAllItems)
            {
                if (!allowedItemTypes.Contains(attributes.type))
                {
                    return(false);
                }
            }
            else if (attributes.size > maxItemSize)
            {
                Debug.Log($"{attributes.size} {item} is too big for {maxItemSize} {eventName}!");
                return(false);
            }
            return(allowAllItems || allowedItemTypes.Contains(attributes.type));
        }
Exemple #2
0
        public bool CheckItemFit(GameObject item)
        {
            ItemAttributes attributes = item.GetComponent <ItemAttributes>();

            if (!allowAllItems)
            {
                if (!allowedItemTypes.Contains(attributes.type))
                {
                    return(false);
                }
                //fixme: following code prevents player from holding/wearing stuff that is wearable in /tg/
            }
            else if (maxItemSize != ItemSize.Large && (maxItemSize != ItemSize.Medium || attributes.size == ItemSize.Large) &&
                     maxItemSize != attributes.size)
            {
                Debug.Log("Item is too big!");
                return(false);
            }
            return(allowAllItems || allowedItemTypes.Contains(attributes.type));
        }
Exemple #3
0
        /// <summary>
        ///     clientside simulation of placement
        /// </summary>
        public bool PlaceItem(Vector3 pos)
        {
            GameObject item = Clear();

            if (!item)
            {
                return(false);
            }
            //            InputTrigger.Touch(item);
            item.transform.position = pos;
            item.transform.parent   = null;
            EditModeControl e = item.GetComponent <EditModeControl>();

            e.Snap();
            ItemAttributes itemAttributes = item.GetComponent <ItemAttributes>();

            Debug.LogFormat("Placing item {0}/{1} from {2} to {3}", item.name,
                            itemAttributes ? itemAttributes.itemName : "(no iAttr)", eventName, pos);
            return(true);
        }
        public ItemType GetItemType(GameObject obj)
        {
            ItemAttributes item = obj.GetComponent <ItemAttributes>();

            return(item.type);
        }
        /// <summary>
        ///     Returns the most fitting slot for a given item to be equipped.
        /// </summary>
        /// <remarks>
        ///     Returns the left pocket for non-equippable items.
        /// </remarks>
        public UI_ItemSlot GetSlotByItem(GameObject obj)
        {
            ItemAttributes item = obj.GetComponent <ItemAttributes>();

            return(GetSlotByItemType(item.type));
        }
        public SpriteType GetItemMasterType(GameObject obj)
        {
            ItemAttributes item = obj.GetComponent <ItemAttributes>();

            return(item.spriteType);
        }