Esempio n. 1
0
 public void PickUp(Item item)
 {
     _items.Add(item);
     OnItemPickedUp?.Invoke(item);
     item.transform.SetParent(_itemsContainer);
     Equip(item);
 }
Esempio n. 2
0
 public static void ItemPickedUp(Item item)
 {
     if (OnItemPickedUp != null)
     {
         OnItemPickedUp.Invoke(item);
     }
 }
Esempio n. 3
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag("Player"))
     {
         OnItemPickedUp?.Invoke(this.gameObject);
     }
 }
Esempio n. 4
0
        public void PickUpClosestItem()
        {
            if (detector.ClosestPickUp == null)
            {
                return;
            }

            pickedUpItem = detector.ClosestPickUp;

            if (pickedUpItem.PickUpItem(playerGrabTransform))
            {
                OnItemPickedUp?.Invoke(pickedUpItem);
            }
        }
Esempio n. 5
0
 public virtual void TakeItem()
 {
     if (Inventory.Instance.CheckIfSpace(m_ObjectData))
     {
         base.PlayerActionEvent();
         Inventory.Instance.AddItem(m_ObjectData, 1);
         OnItemPickedUp?.Invoke(m_ObjectData);
         Destroy(this.gameObject);
     }
     else
     {
         Inventory.Instance.SlotsAreAllTaken();
         Debug.Log("Cant pick up backpack is full");
     }
 }
Esempio n. 6
0
        public bool TryReceiveItem(PickUp item)
        {
            if (pickedUpItem != null)
            {
                return(false);
            }

            if (item.PickUpItem(playerGrabTransform))
            {
                pickedUpItem = item;
                OnItemPickedUp?.Invoke(pickedUpItem);
                return(true);
            }

            return(false);
        }
Esempio n. 7
0
 public static void ItemPickedUp(string nameOfObject)
 {
     OnItemPickedUp?.Invoke(nameOfObject);
 }
Esempio n. 8
0
 public static void FireItemPickedUp(TrinityItem item)
 {
     Core.Logger.Log(LogCategory.ItemEvents, $"ItemPickedUp {item.Name}");
     OnItemPickedUp?.Invoke(item);
 }