Skip to content
Snippets Groups Projects
Inventory.cs 812 B
Newer Older
  • Learn to ignore specific revisions
  • BenniHome's avatar
    BenniHome committed
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    
    
    [CreateAssetMenu(fileName = "New Inventory", menuName= "Inventory System/Inventory" )]
    public class Inventory : ScriptableObject
    
    BenniHome's avatar
    BenniHome committed
    {
    
       public List<InventorySlot<ItemObject>> Facts = new List<InventorySlot<ItemObject>>();
       public List<InventorySlot<DefaultScroll>> Scrolls = new List<InventorySlot<DefaultScroll>>();
    
    BenniHome's avatar
    BenniHome committed
    
       public void AddFact(ItemObject fact){
    
         Facts.Add(new InventorySlot<ItemObject>(fact));
    
    BenniHome's avatar
    BenniHome committed
       }
    
    
       public void AddScroll(DefaultScroll scroll){
          Scrolls.Add(new InventorySlot<DefaultScroll>(scroll));
    
    BenniHome's avatar
    BenniHome committed
       }
    }
    
       [System.Serializable]
    
    public class InventorySlot<T>
    
    BenniHome's avatar
    BenniHome committed
    {
    
       public T  item;
    
    BenniHome's avatar
    BenniHome committed
       public bool isDisplayed;
    
    
       public InventorySlot( T _item){
    
    BenniHome's avatar
    BenniHome committed
          item = _item;
          isDisplayed = false;
       }
    }