JojikYT

PickUpItem

Jan 26th, 2023
2,165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.67 KB | Source Code | 0 0
  1. using System.Collections;
  2. using UnityEngine;
  3.  
  4. public class PickUpItem : Interactable
  5. {
  6.     [Header("Item Data")]  
  7.     [SerializeField] string itemName;
  8.     //[SerializeField] Item item;
  9.     //[SerializeField] int amount = 1;
  10.  
  11.     public override void Start()
  12.     {
  13.         base.Start();
  14.         //interactableName = item.itemName;
  15.         interactableName = itemName;       
  16.     }
  17.  
  18.     protected override void Interaction()
  19.     {
  20.         base.Interaction();
  21.         print("I put " + itemName + " in my inventory.");
  22.         Destroy(this.gameObject);
  23.        
  24.         //animation
  25.         //animator.SetTrigger("PickUp");
  26.  
  27.         //add to inventory via events
  28.         //Events.AddInventoryItem(item,amount);
  29.  
  30.     }
  31.  
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment