public override int Use()
        {
            int used = base.Use();

            if (used < 0)
            {
                return(used);
            }

            if (actor.actorClass.currLevel < requiredLevel)
            {
                InventoryManager.instance.lang.itemCannotBeUsedLevelToLow.Show(name, description, requiredLevel);
                return(-1);
            }

            SetPlyGameValues();

            if (audioClipWhenUsed != null)
            {
                InventoryUIUtility.AudioPlayOneShot(audioClipWhenUsed);
            }

            currentStackSize--;
            NotifyItemUsed(1, true);
            return(1);
        }
예제 #2
0
        //public override int Use()
        //{
        //    if (addDirectlyToWeapon)
        //        return -1;

        //    int used = base.Use();
        //    if (used < 0)
        //        return used;

        //    // Un-Equipping
        //    bool added = AddToUFPSAmmo();
        //    if (added)
        //    {
        //        currentStackSize = 0; // TODO: Fix this, if UFPS accepts less units...
        //        NotifyItemUsed(currentStackSize, true);
        //        return (int)currentStackSize;
        //    }

        //    return 0;
        //}

        public override bool PickupItem(bool addToInventory = true)
        {
            currentStackSize = unitAmount;
            if (addDirectlyToWeapon)
            {
                // Add bullets directly to weapon
                //unitType.Space
                bool added = AddToUFPSAmmo();
                if (added)
                {
                    if (pickupSound != null)
                    {
                        InventoryUIUtility.AudioPlayOneShot(pickupSound);
                    }

                    Destroy(gameObject); // Get rid of object
                    return(true);
                }
            }
            else
            {
                bool pickedup = base.PickupItem(addToInventory); // Add to inventory instead.
                if (pickedup)
                {
                    if (pickupSound != null)
                    {
                        InventoryUIUtility.AudioPlayOneShot(pickupSound);
                    }

                    return(true);
                }
            }

            return(false);
        }
예제 #3
0
 protected virtual void PositionInfoBox()
 {
     if (positionAtMouse)
     {
         InventoryUIUtility.PositionRectTransformAtPosition(rectTransform, Input.mousePosition);
         HandleBorders();
     }
 }