Пример #1
0
        public override TaskStatus OnUpdate()
        {
            generator.SetItems(ItemManager.database.items);
            generator.Generate(minAmount.Value, maxAmount.Value);

            return(TaskStatus.Success);
        }
        public override void Awake()
        {
            base.Awake();
            generator = new BasicItemGenerator();

            generator.SetItems(ItemManager.database.items);
            var itemsTemp = generator.Generate(minAmount.Value, maxAmount.Value);

            items.objectReferences = itemsTemp;
        }
        public override TaskStatus OnUpdate()
        {
#if UNITY_EDITOR
            var m = UnityEditor.Editor.FindObjectOfType <ItemManager>();
            generator.SetItems(m.items);
#else
            generator.SetItems(ItemManager.instance.items);
#endif
            generator.Generate(minAmount.Value, maxAmount.Value);

            return(TaskStatus.Success);
        }
Пример #4
0
        public override void Awake()
        {
            base.Awake();
            generator = new BasicItemGenerator();

#if UNITY_EDITOR
            var m = Editor.FindObjectOfType<ItemManager>();
            generator.SetItems(m.items);
#else
            generator.SetItems(ItemManager.instance.items);
#endif
            generator.Generate(minAmount.Value, maxAmount.Value);
        }
Пример #5
0
        public override void Awake()
        {
            base.Awake();
            generator = new BasicItemGenerator();

#if UNITY_EDITOR
            var m = Editor.FindObjectOfType <ItemManager>();
            generator.SetItems(m.items);
#else
            generator.SetItems(ItemManager.instance.items);
#endif
            generator.Generate(minAmount.Value, maxAmount.Value);
        }
Пример #6
0
        public override BlockReturn Run(BlockReturn param)
        {
            generator = new BasicItemGenerator();

#if UNITY_EDITOR
            var m = Editor.FindObjectOfType <ItemManager>();
            generator.SetItems(m.items);
#else
            generator.SetItems(ItemManager.instance.items);
#endif
            this.items = generator.Generate(minAmount.value, maxAmount.value);


            return(BlockReturn.OK);
        }
        protected void Awake()
        {
            container = GetComponent <IInventoryItemContainer>();

            generator = new FilterGroupsItemGenerator(filterGroups);
            generator.SetItems(ItemManager.database.items);

            if (generateAtGameStart)
            {
                container.items = generator.Generate(minAmountTotal, maxAmountTotal, true); // Create instances is required to get stack size to work (Can't change stacksize on prefab)
                foreach (var item in container.items)
                {
                    item.transform.SetParent(transform);
                }
            }
        }
        public virtual void CreateGenerator()
        {
            var generator = new BasicItemGenerator();

            generator.SetItems(ItemManager.instance.items, 1.0f);
            generator.onlyOfType = new List <System.Type>(vendorUI.onlyAllowTypes);
            //generator.maxBuyPrice = 50;
            //generator.onlyOfType.Add(typeof(ConsumableInventoryItem));
            //generator.onlyOfType.Add(typeof(UnusableInventoryItem));
            itemGenerator = generator;

            if (generateItems)
            {
                forSale = itemGenerator.Generate(generateItemsCount);
            }
        }
        protected virtual InventoryItemBase[] GenerateItems()
        {
            canGenerateItems = false;
            generator        = new FilterGroupsItemGenerator(filterGroups);
            generator.SetItems(ItemManager.database.items);

            var items = generator.Generate(minAmountTotal, maxAmountTotal, true); // Create instances is required to get stack size to work (Can't change stacksize on prefab)

            foreach (var item in items)
            {
                item.transform.SetParent(transform);
                item.gameObject.SetActive(false);
            }

            return(items);
        }
        public virtual void CreateGenerator()
        {
            var generator = new BasicItemGenerator();
            generator.SetItems(ItemManager.instance.items, 1.0f);
            generator.onlyOfType = new List<System.Type>(InventoryManager.instance.vendor.onlyAllowTypes);
            //generator.maxBuyPrice = 50;
            //generator.onlyOfType.Add(typeof(ConsumableInventoryItem));
            //generator.onlyOfType.Add(typeof(UnusableInventoryItem));
            itemGenerator = generator;

            if (generateItems)
            {
                var t = itemGenerator.Generate(minAmount, maxAmount);
                items = new InventoryItemBase[t.Length];
                for (int i = 0; i < items.Length; i++)
                {
                    items[i] = GameObject.Instantiate<InventoryItemBase>(t[i]);
                    items[i].gameObject.SetActive(false);
                    items[i].transform.SetParent(transform);
                }
            }
        }
        public virtual void CreateGenerator()
        {
            var generator = new BasicItemGenerator();

            generator.SetItems(ItemManager.instance.items, 1.0f);
            generator.onlyOfType = new List <System.Type>(InventoryManager.instance.vendor.onlyAllowTypes);
            //generator.maxBuyPrice = 50;
            //generator.onlyOfType.Add(typeof(ConsumableInventoryItem));
            //generator.onlyOfType.Add(typeof(UnusableInventoryItem));
            itemGenerator = generator;

            if (generateItems)
            {
                var t = itemGenerator.Generate(minAmount, maxAmount);
                items = new InventoryItemBase[t.Length];
                for (int i = 0; i < items.Length; i++)
                {
                    items[i] = GameObject.Instantiate <InventoryItemBase>(t[i]);
                    items[i].gameObject.SetActive(false);
                    items[i].transform.SetParent(transform);
                }
            }
        }
        public virtual void CreateGenerator()
        {
            var generator = new BasicItemGenerator();
            generator.SetItems(ItemManager.instance.items, 1.0f);
            generator.onlyOfType = new List<System.Type>(vendorUI.onlyAllowTypes);
            //generator.maxBuyPrice = 50;
            //generator.onlyOfType.Add(typeof(ConsumableInventoryItem));
            //generator.onlyOfType.Add(typeof(UnusableInventoryItem));
            itemGenerator = generator;

            if(generateItems)
                forSale = itemGenerator.Generate(generateItemsCount);
        }