//public void enableExamineObjectText(string examineText)
    //{
    //    Debug.Log(examineText);
    //    UI_playerThoughtsText.GetComponent<Text>().enabled = true;
    //    UI_playerThoughtsText.GetComponent<Text>().text = examineText;
    //    showExamineObjectText = true;
    //    examineStartTime = Time.time;
    //}

    public void enableCombineWithText(ItemInteractionScript _combiningItem)
    {
        combiningInProgress = true;
        combiningItem       = _combiningItem;
        UI_nameOfHighlightedObject.GetComponent <Text>().enabled = true;
        UI_nameOfHighlightedObject.GetComponent <Text>().text    = "Combine with ...";
    }
 public void stopHighlightingInventoryItem(ItemInteractionScript item)
 {
     if (highlightedInventoryItem == item)
     {
         highlightedInventoryItem = null;
     }
 }
    private void closeCurrentSelectionMenu()
    {
        if (aSelectionMenuIsOpen)
        {
            if (selectedWorldObject != null)
            {
                InteractableObjectScript unselectedWorldObject = selectedWorldObject;
                selectedWorldObject = null;
                GameObject.FindGameObjectWithTag("SelectedObjectMenu_UIText").GetComponent <SelectedObjectMenuScript>().closeMenu();

                // check if mouse is still over object
                RaycastHit mouseRayHit;
                Ray        mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition);
                if (Physics.Raycast(mouseRay, out mouseRayHit))
                {
                    InteractableObjectScript hitObjectInteractionScript = mouseRayHit.collider.GetComponent <InteractableObjectScript>();
                    if (hitObjectInteractionScript == unselectedWorldObject)
                    {
                        setHighlightedWorldObject(hitObjectInteractionScript);
                    }
                }
            }

            if (selectedInventoryItem != null)
            {
                selectedInventoryItem.closeItemMenu();
                selectedInventoryItem = null;
            }

            aSelectionMenuIsOpen = false;
        }
    }
    public bool combineActors(ItemInteractionScript inventorySlotOfFirstItem, InteractableObjectScript worldObjectCombinedWith)
    {
        bool actorsNeedSwitching = false;
        // check if these actors can be combined
        int indexOfSecondActor = getIndexOfSecondActor(inventorySlotOfFirstItem.dataOfItemInSlot, worldObjectCombinedWith.data);

        if (indexOfSecondActor == -1)
        {
            // switch first actor and second actor and check again
            indexOfSecondActor = getIndexOfSecondActor(worldObjectCombinedWith.data, inventorySlotOfFirstItem.dataOfItemInSlot);
            if (indexOfSecondActor == -1)
            {
                return(false);
            }
            else
            { // switch the actors around
                actorsNeedSwitching = true;
            }
        }

        ActorData firstActorData;
        ActorData secondActorData;

        if (actorsNeedSwitching)
        {
            firstActorData  = worldObjectCombinedWith.data;
            secondActorData = inventorySlotOfFirstItem.dataOfItemInSlot;
        }
        else
        {
            firstActorData  = inventorySlotOfFirstItem.dataOfItemInSlot;
            secondActorData = worldObjectCombinedWith.data;
        }

        // remove actors if necessary
        if (firstActorData.actorsThisCanBeCombinedWith[indexOfSecondActor].outcomeForThisActor == ActorData.ActorOutcomeAfterCombination.Deactivate)
        {
            FindObjectOfType <InventoryScript>().removeItem(firstActorData);
        }

        if (firstActorData.actorsThisCanBeCombinedWith[indexOfSecondActor].outcomeForOtherActor == ActorData.ActorOutcomeAfterCombination.Deactivate)
        {
            currentScene.deactivateWorldObject(worldObjectCombinedWith.gameObject);
        }

        resolveComination(firstActorData, secondActorData, indexOfSecondActor);

        return(true);
    }
    public bool separateActor(ItemInteractionScript inventoryItemToSeparate)
    {
        // splits previously combined inventory item into components

        ActorData objectToSeparateData = inventoryItemToSeparate.dataOfItemInSlot;

        FindObjectOfType <InventoryScript>().removeItem(objectToSeparateData);

        if (!resolveSeparation(objectToSeparateData))
        {
            Debug.Log("separation failed");
            FindObjectOfType <InventoryScript>().addItem(objectToSeparateData);
            return(false); // return false and readd removed item if separation is not possible
        }

        return(true);
    }
    public void setHighlightedInventoryItem(ItemInteractionScript item)
    {
        // don't highlight if item is already selected
        if (item == selectedInventoryItem)
        {
            return;
        }

        // clear current highlighted item
        if (highlightedInventoryItem != null)
        {
            stopHighlightingInventoryItem(highlightedInventoryItem);
        }

        // set this object as highlighted item
        if (item != null)
        {
            highlightedInventoryItem = item;
        }
    }
    public void inventoryItemClickedOn(ItemInteractionScript inventoryItem)
    {
        if (combiningInProgress && inventoryItem != combiningItem)
        {
            // check if the item player is attempting to combine with is the notebook
            if (inventoryItem.itemSlotIndex == 0)
            {
                GameManagerScript.gameManager.GetComponent <ConversationScript>().showConversation(GameManagerScript.gameManager.failedItemCombinationConversationData);
            }
            //enableExamineObjectText("I can't combine those...");

            // try to combine items
            else if (!GameManagerScript.gameManager.combineActors(combiningItem, inventoryItem))
            {
                GameManagerScript.gameManager.GetComponent <ConversationScript>().showConversation(GameManagerScript.gameManager.failedItemCombinationConversationData);
            }
            //enableExamineObjectText("I can't combine those...");

            else
            {
                combiningInProgress = false;
                checkIfMouseHighlightingObject();
            }
        }

        else
        {
            closeCurrentSelectionMenu();
            selectedInventoryItem = inventoryItem;
            selectedInventoryItem.openItemMenu();

            // the notebook has no selection menu, so it does not need to be set as 'open' if the notebook was the item clicked on.
            //if (inventoryItem.itemSlotIndex != 0)
            //{
            aSelectionMenuIsOpen = true;
            //}
        }
    }