Exemple #1
0
    /// <summary>
    /// Sets this inventory slot item to be selected
    /// </summary>
    public void SetSelectedItem()
    {
        // Clear currently highlighted items
        inventoryBar.ClearHighlightOnInventorySlots();

        // Highlight item oninventory bar
        isSelected = true;

        // Set highlighted inventory slots
        inventoryBar.SetHighlightedInventorySlots();

        // Set use radius for cursors
        gridCursor.ItemUseGridRadius = itemDetails.itemUseGridRadius;
        cursor.ItemUseRadius         = itemDetails.itemUseRadius;

        // if item require a grid cursor then enable it
        if (itemDetails.itemUseGridRadius > 0)
        {
            gridCursor.EnableCursor();
        }
        else
        {
            gridCursor.DisableCursor();
        }

        // use cursor use radius to enable/ disable
        if (itemDetails.itemUseRadius > 0)
        {
            cursor.EnableCursor();
        }
        else
        {
            cursor.DisableCursor();
        }

        // Set item type
        gridCursor.SelectedItemType = itemDetails.itemType;
        cursor.SelectedItemType     = itemDetails.itemType;


        // Set item selected in inventory
        InventoryManager.Instance.SetSelectedInventoryItem(InventoryLocation.player, itemDetails.itemCode);

        if (itemDetails.canBeCarried == true)
        {
            // show player carryin item
            Player.Instance.ShowCarriedItem(itemDetails.itemCode);
        }
        else
        {
            // show player carrying nothing
            Player.Instance.ClearCarriedItem();
        }
    }
Exemple #2
0
    private void SetSelectedItem()
    {
        // Clear currently highlighted items
        inventoryBar.ClearHighlightOnInventorySlots();

        // Highlight item on inventory bar
        isSelected = true;

        // Set highlighted inventory slots
        inventoryBar.SetHighlightedInventorySlots();

        // Store the item's use radius for the cursors
        gridCursor.ItemUseGridRadius = itemDetails.itemUseGridRadius;
        cursor.ItemUseRadius         = itemDetails.itemUseRadius;

        // If the item's itemUseGridRadius is greater than 0 we want to enable the grid cursor, else disable it
        if (itemDetails.itemUseGridRadius > 0)
        {
            gridCursor.EnableCursor();
        }
        else
        {
            gridCursor.DisableCursor();
        }

        // If the item's itemUseRadius is greater than 0 we want to enable the grid cursor, else disable it
        if (itemDetails.itemUseRadius > 0f)
        {
            cursor.EnableCursor();
        }
        else
        {
            cursor.DisableCursor();
        }


        // Set the cursors' SelectedItemType to the item's itemType
        gridCursor.SelectedItemType = itemDetails.itemType;
        cursor.SelectedItemType     = itemDetails.itemType;

        // Set item selected in inventory
        InventoryManager.Instance.SetSelectedInventoryItem(InventoryLocation.player, itemDetails.itemCode);

        if (itemDetails.canBeCarried == true)
        {
            Player.Instance.ShowCarriedItem(itemDetails.itemCode);
        }
        else
        {
            Player.Instance.ClearCarriedItem();
        }
    }
Exemple #3
0
    /// <summary>
    /// Sets this inventorySlot item to be selected
    /// </summary>
    private void SetSelectedItem()
    {
        // clear the currently highlighted items
        inventoryBar.ClearHighlightOnInventorySlots();

        // Highlight the item on the inventory bar
        isSelected = true;

        // Set highlighted inventory slots
        inventoryBar.SetHighlightedInventorySlots();

        // Set the use gridradius and radius for the cursors in GridCursor and Cursor
        gridCursor.ItemUseGridRadius = itemDetails.itemUseGridRadius;
        cursor.ItemUseRadius         = itemDetails.itemUseRadius;

        // If the item requires a grid cursor (useRadius > 0), then enable it. Else, diable it
        if (itemDetails.itemUseGridRadius > 0)
        {
            gridCursor.EnableCursor();
        }
        else
        {
            gridCursor.DisableCursor();
        }

        // If the item requires a cursor (useRadius > 0), then enable it. Else, diable it
        if (itemDetails.itemUseRadius > 0)
        {
            cursor.EnableCursor();
        }
        else
        {
            cursor.DisableCursor();
        }

        // Set the item type for both cursors
        gridCursor.SelectedItemType = itemDetails.itemType;
        cursor.SelectedItemType     = itemDetails.itemType;

        // Set item selected in inventory list
        InventoryManager.Instance.SetSelectedInventoryItem(InventoryLocation.player, itemDetails.itemCode);

        if (itemDetails.canBeCarried == true)
        {
            // Show the player carrying the item
            Player.Instance.ShowCarriedItem(itemDetails.itemCode);
        }
        else // Show the player carrying nothing
        {
            Player.Instance.ClearCarriedItem();
        }
    }