Activate() public method

public Activate ( Item, item, int amt, int inv_pos ) : void
item Item,
amt int
inv_pos int
return void
Example #1
0
    /*-------------------------------------------------------------------------------------------------
    *  -- FUNCTION:     OnPointerClick
    *  -- DATE:         26/02/2016
    *  -- REVISIONS:
    *  -- DESIGNER:     Joseph Tam-Huang
    *  -- PROGRAMMER:   Joseph Tam-Huang
    *  -- INTERFACE:    public void OnPointerClick(PointerEventData eventData)
    *  --                  PointerEventData eventData: The event payload associated with pointer events.
    *  -- RETURNS:  void
    *  -- NOTES:
    *  -- Handles click event on inventory items. Right click activates the item menu, left click uses
    *  -- the item if it is a consumable.
    *  -------------------------------------------------------------------------------------------------*/
    public void OnPointerClick(PointerEventData eventData)
    {
        if (eventData.pointerId == -2)
        {
            _item_menu.Activate(item, amount, item_pos);
        }

        // Left click: call useConsumable() if the item is of the consumable types
        if (eventData.pointerId == -1)
        {
            if (item.type == Constants.CONSUMABLE_TYPE)
            {
                _inventory.UseConsumable(item_pos);
            }
        }
    }