Example #1
0
        /// <summary>
        /// Update useMessage with appropriate text related to the item, can probably be put in a static class later on
        /// </summary>
        void UpdateUseText()
        {
            Interactable itemInView = playerInteract.GetItemInView();

            onUseMessage = onUseMessage.Replace("{item}", item.name);
            if (itemInView)
            {
                onUseMessage = onUseMessage.Replace("{itemInView}", itemInView.name);
            }
        }
 void Update()
 {
     if (currentEquippedItem)
     {
         Pickupable pickupable = currentEquippedItem.GetComponent <Pickupable>();
         //Using item that the player has equipped
         if (Input.GetButtonDown("Fire1"))
         {
             pickupable.OnUse(gameObject, interactSystem.GetItemInView());
             OnUseItem?.Invoke(pickupable);
         }
         if (Input.GetButtonDown("DropItem"))
         {
             DropItem(pickupable.item);
         }
     }
 }