Advertisement
celinedrules

InventoryItem

Apr 17th, 2020
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.96 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Events;
  5.  
  6. [CreateAssetMenu(fileName = "New Item", menuName = "My Assets/Inventory/Item")]
  7. public class InventoryItem : ScriptableObject
  8. {
  9.     [SerializeField] private string itemName;
  10.     [SerializeField] private string itemDescription;
  11.     [SerializeField] private Sprite itemImage;
  12.     [SerializeField] private int numHeld;
  13.     [SerializeField] private bool usable;
  14.     [SerializeField] private bool unique;
  15.     [SerializeField] private UnityEvent thisEvent;
  16.  
  17.     public Sprite ItemImage { get => itemImage; set => itemImage = value; }
  18.     public int NumHeld { get => numHeld; set => numHeld = value; }
  19.     public string ItemDescription { get => itemDescription; set => itemDescription = value; }
  20.     public bool Usable { get => usable; set => usable = value; }
  21.  
  22.     public void Use()
  23.     {
  24.         Debug.Log("Using Item");
  25.         thisEvent.Invoke();
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement