public void Awake()
    {
        Debug.Assert(_inventoryElement != null, "need _inventoryElement");


        _inventoryElement.OnAddingItem += UpdatePrice;
        _inventoryElement.OnRemovingItem += UpdatePrice;

        _inventoryElement.Start(_pslot,_inventoryController.SlotClicked,_inventoryController.SlotHover, _inventoryController.SlotStopHover);

        UpdatePrice();
    }
示例#2
0
    void Awake()
    {
        Debug.Assert(_pslot != null, "Inventory need a slot prefab");
        Debug.Assert(_uiSelector != null, "Inventory Bar need a selector");
        Debug.Assert(MAX_ITEM_PER_STACK != 0, "max item per stack not set");

        _playerActions = new PlayerActions();
        _playerActions.Inventory.MoveBarSelector.performed += UpdateSelectorPosition;
        _playerActions.Inventory.ToggleInventory.performed += ToggleInventory;
        _playerActions.Inventory.CursorPosition.performed  += (InputAction.CallbackContext ctx) => { _tooltip.Postion = ctx.ReadValue <Vector2>() + new Vector2(3, -3); };
        _playerActions.Inventory.ShowDescritpion.started   += (InputAction.CallbackContext ctx) => { _tooltip.ShowDescription(); };
        _playerActions.Inventory.ShowDescritpion.canceled  += (InputAction.CallbackContext ctx) => { _tooltip.HideDescription(); };

        _bar.Start(_pslot, SlotClicked, SlotHover, SlotStopHover);
        _inventory.Start(_pslot, SlotClicked, SlotHover, SlotStopHover);

        _mouseStack = new Stack();

        _idSelected = 0;
        _money      = 0;
    }