Example #1
0
    private void HandleToolTipRaycasting()
    {
        if (interactableObjectsWithinRange.Count > 0)
        {
            bool           playerIsLookingAtInteractable = false;
            FN_ItemManager itemManager;
            //Debug.Log("interactableObjectsWithinRange: " + interactableObjectsWithinRange.Count);
            GOPlayerIsCurrentlyLookingAt = WhatIsPlayerLookingAt();

            for (int i = 0; i < interactableObjectsWithinRange.Count; ++i)
            {
                itemManager = interactableObjectsWithinRange[i].GetComponent <FN_ItemManager>();
                //is the player pointing at an item that is within interaction range?
                playerIsLookingAtInteractable = itemManager.CompareModel(GOPlayerIsCurrentlyLookingAt);
                if (playerIsLookingAtInteractable)
                {
                    itemManagerPlayerIsLookingAt = itemManager;
                }
                itemManager.ToggleToolTipVisibility(playerIsLookingAtInteractable);
            }
        }
        else
        {//there is nothing nearby for the player to look at
            itemManagerPlayerIsLookingAt = null;
        }
    }
Example #2
0
    }//end AddStackableInventory()

    public bool AddItem(FN_ItemManager itemManager)
    {
        Item item           = itemManager.scriptableObject_Item;
        bool itemAddSuccess = false;


        //if(item is Ammo)
        //{
        //}
        //else if (item is Attachment)
        //{
        //}
        if (item is Currency)
        {
            //TODO currency dictionary
            itemAddSuccess = ModifyMoney(itemManager.ItemAmount);
        }
        else if (item is Resource)
        {
            //TODO Resource dictionary
            itemAddSuccess = ModifyResources(item as Resource);
        }
        //else if (item is Throwable)
        //{

        //}
        //else if(item is Weapon)
        //{
        //    //done
        //    if (inventoryArray.Count < inventorySlots)
        //    {
        //        itemAddSuccess = AddToNextAvailableSlot(item);
        //    }
        //}
        else
        {
            if (item.stackQuantity <= 1)
            {
                if (DEBUG)
                {
                    Debug.Log("Item is not stackable....");
                }
                itemAddSuccess = AddToNextAvailableSlot(item);
            }
            else
            {
                int quantityRemaining = AddStackableInventory(item, itemManager.ItemAmount);
                itemManager.ItemAmount = quantityRemaining;
                itemAddSuccess         = false;//redundant
            }
        }
        //if (DEBUG && itemAddSuccess) Debug.Log("Item successfully added to inventory!");
        //if (DEBUG && !itemAddSuccess) Debug.Log("Item was not added inventory.");

        return(itemAddSuccess);
    }//end AddItem()