Beispiel #1
0
        private void OnInventoryChange(global::Item.Inventory inv, InventoryEventArgs e)
        {
            var i       = e.Index;
            var uiSlot  = _slots[i];
            var invItem = _inventory.Get(i);

            uiSlot.SetItem(invItem);
            UpdateRecipes();
        }
Beispiel #2
0
        private void OnEnable()
        {
            var player = GameObject.FindGameObjectWithTag("Player");

            _player              = player.GetComponent <PlayerController>();
            _inventory           = _player.Inventory;
            _inventory.OnChange += OnInventoryChange;
            _player.Craft.OnAvailRecipeChange += OnAvailRecipeChange;

            InitializeSlots();
            InitializeRecipes();
        }
Beispiel #3
0
        private void OnEnable()
        {
            var player = GameObject.FindGameObjectWithTag("Player");

            _player              = player.GetComponent <PlayerController>();
            _inventory           = _player.Inventory;
            _inventory.OnChange += OnInventoryChange;

            InitializeSlots();

            _healthBar  = healthBar.GetComponent <UIProgress>();
            _staminaBar = staminaBar.GetComponent <UIProgress>();
        }
Beispiel #4
0
        private void OnInventoryChange(global::Item.Inventory inv, InventoryEventArgs e)
        {
            var i = e.Index;

            if (i >= 6)
            {
                return;
            }

            var uiSlot  = _slots[i];
            var invItem = _inventory.Get(i);

            uiSlot.SetItem(invItem);
        }