Esempio n. 1
0
 //Use the item
 public virtual void Use()
 {
     Container.NotifyTryUseItem(ObservedItem, this);
     //Check if the item can be used.
     if (CanUse())
     {
         //Check if there is an override item behavior on trigger.
         if ((Trigger.currentUsedTrigger as Trigger) != null && (Trigger.currentUsedTrigger as Trigger).OverrideUse(this, ObservedItem))
         {
             return;
         }
         if (Container.UseReferences)
         {
             ObservedItem.Slot.Use();
             return;
         }
         //Try to move item
         if (!MoveItem())
         {
             Debug.Log("use");
             ObservedItem.Use();
             Container.NotifyUseItem(ObservedItem, this);
         }
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Use the item in slot
 /// </summary>
 public override void Use()
 {
     //Check if the item can be used.
     if (CanUse())
     {
         //Check if there is an override item behavior on trigger.
         if ((Trigger.currentUsedTrigger as Trigger) != null && (Trigger.currentUsedTrigger as Trigger).OverrideUse(this, ObservedItem))
         {
             return;
         }
         if (Container.UseReferences)
         {
             ObservedItem.Slot.Use();
             return;
         }
         //Try to move item
         if (!MoveItem())
         {
             CloseTooltip();
             ObservedItem.Use();
             Container.NotifyUseItem(ObservedItem, this);
         }
         else
         {
             CloseTooltip();
             ShowTooltip();
         }
     }
     else if (IsCooldown && !IsEmpty)
     {
         InventoryManager.Notifications.inCooldown.Show(ObservedItem.Name, (cooldownDuration - (Time.time - cooldownInitTime)).ToString("f2"));
     }
 }