private void Start() { _inventoryComponent = transform.parent.GetComponentInChildren <InventoryComponent>(); _sumText = GetComponent <Text>(); _sumText.text = string.Empty; _changeAmountEntityInInventoryListener = new ChangeAmountEntityInInventoryListener(_inventoryComponent); _changeAmountEntityInInventoryListener.On(); _changeAmountEntityInInventoryListener.ChangeAmountEvent.AddListener(data => UpdateSum()); UpdateSum(); }
private void Init() { // DataEntities _heroComponent = FindObjectOfType <HeroComponent>(); var bagEntities = ResourcesExt.LoadDataEntities(NameBag); var dummyEntities = ResourcesExt.LoadDataEntities(NameDummy); // Inventories _dummy = new InventoryOpenCloseObject(_prefabDummyInventory, dummyEntities, NameDummy); _bag = new InventoryOpenCloseObject(_prefabBagInventory, bagEntities, NameBag); _inventoryDataBindHotBar = _containerDi.InventoryBindingFactory.Create(_inventoryComponentHotBar) .Bind(_inventoryComponentHotBar); // Listeners _buffDebafListener = new BuffDebuffListener(_heroComponent, _dummy); _hotBarListener = new HotBarListener(_inventoryDataBindHotBar, _bag); _changeAmountEntityInInventoryListener = new ChangeAmountEntityInInventoryListener(_bag); }