using System.Collections.Generic; using Assets.HeroEditor4D.Common.Scripts.CharacterScripts; using Assets.HeroEditor4D.InventorySystem.Scripts; using Assets.HeroEditor4D.InventorySystem.Scripts.Data; using Assets.HeroEditor4D.InventorySystem.Scripts.Elements; using UnityEngine; namespace Assets.HeroEditor4D.Common.Scripts.ExampleScripts { public class InventoryExample : MonoBehaviour { public ItemCollection ItemCollection; public ScrollInventory Inventory; public Character4D Character; public void Awake() { // You must to set an active collection (as there may be several different collections in Resources). ItemCollection.Active = ItemCollection; } public void Start() { var items = new List { new Item("Gold", 99), new Item("Apple", 99), new Item("WarriorHelmet"), new Item("WarriorArmor"), new Item("Sabre"), new Item("DestroyerGreataxe"), new Item("GreatShield"), new Item("CurvedShortBow"), new Item("PirateHat"), new Item("LongBarreledPistol"), new Item("GoldenRing") }; InventoryItem.OnLeftClick = item => Character.Equip(item); Inventory.Initialize(ref items); } } }