Beispiel #1
0
 public bool Interact(ACustomItem item)
 {
     if (item.IsSellable())
     {
         item.FreeItemSlot();
         PlayerMoneyInLevel.Instance.LooseMoney(ItemsCost.ComputeItemCost(item));
         Destroy(item.gameObject);
         return(true);
     }
     return(false);
 }
    public override void AssignSlot(ACustomItem item)
    {
        System.Type interactibleType = System.Type.GetType(_interactibleItemTypeString);

        if (item.GetType() == interactibleType)
        {
            item.Slot  = this;
            IsOccupied = true;
        }
        else
        {
            item.Slot = null;
        }
    }
    private int GetItemIndexInOrder(ACustomItem item)
    {
        int index = 0;

        foreach (OrderItems.OrderItem orderItem in Info.orderItems)
        {
            if (item.CheckOrderItem(orderItem) && !orderItem.IsGiven)
            {
                return(index);
            }
            index += 1;
        }
        return(-1);
    }
    public bool Interact(ACustomItem item)
    {
        int itemIndexInOrder = GetItemIndexInOrder(item);

        if (item.IsSellable() && itemIndexInOrder != -1)
        {
            Info.orderItems[itemIndexInOrder].IsGiven = true;
            _displayOrderUI.ShowItemAsGiven(itemIndexInOrder);
            item.FreeItemSlot();
            Destroy(item.gameObject);
            if (IsOrderComplete())
            {
                HasFulfilledOrder = true;
            }
            return(true);
        }
        return(false);
    }
    private void Drop()
    {
        ACustomItem customItem = GetComponent <ACustomItem>();
        bool        interactResponse;

        if (SupplyBox != null)
        {
            customItem.SetItemSlotManager(SupplyBox._itemSlotManager);
        }
        interactResponse = customItem.InteractOnDrop();

        // Decrements supply box capacity only if the drag was coming from a supply box and if the drop was successfull
        // (It can be unsuccessfull if not enough slot available)
        if (SupplyBox != null && interactResponse)
        {
            SupplyBox.DecrementCurrentCapacity();
            SupplyBox = null;
        }
    }
Beispiel #6
0
    public bool Interact(ACustomItem item)
    {
        CustomYokaiMask yokaiMask;

        if (item.GetType() != typeof(CustomYokaiMask))
        {
            return(false);
        }

        yokaiMask = (CustomYokaiMask)item;
        // Mix potion only if it already has a slot assigned or if a slot is assigned successfully
        if (!yokaiMask.HasSlotAssigned())
        {
            if (yokaiMask._itemSlotManager.AssignFirstSlotAvailable(item, false))
            {
                return(MixPaint(yokaiMask));
            }
        }
        else
        {
            return(MixPaint(yokaiMask));
        }
        return(false);
    }
    public bool Interact(ACustomItem item)
    {
        CustomPotion potion;

        if (item.GetType() != typeof(CustomPotion))
        {
            return(false);
        }

        potion = (CustomPotion)item;
        // Mix potion only if it already has a slot assigned or if a slot is assigned successfully
        if (!potion.HasSlotAssigned())
        {
            if (potion._itemSlotManager.AssignFirstSlotAvailable(item, false))
            {
                return(MixPotion(potion));
            }
        }
        else
        {
            return(MixPotion(potion));
        }
        return(false);
    }
 public bool Interact(ACustomItem item)
 {
     return(_itemSlotManager.AssignFirstSlotAvailable(item, true));
 }
 public static int ComputeItemCost(ACustomItem customItem)
 {
     return(ComputeItemCostFromType(customItem.GetType(), customItem.Complexity));
 }
Beispiel #10
0
 public abstract void AssignSlot(ACustomItem item);