Пример #1
0
    /// <summary>
    /// Uses Item action(s) of a selected item in the hotbar, if valid.
    /// </summary>
    public void UseItemActions()
    {
        GameItem selectedItem = GetSelectedItem();

        if (selectedItem == null)
        {
            return;
        }

        if (selectedItem is UsableItem)
        {
            UsableItem selectedUsable = (UsableItem)selectedItem;
            if (selectedUsable.ValidateUse(gameObject))
            {
                //Player selected to use the current item, and it is valid to be used
                selectedUsable.Use(gameObject);
            }
        }
    }