示例#1
0
    //-------------------------------------------------------------------------

    /*!
    **	Called by an [Interactable] if it was left-clicked.
    */
    public void Notify(int id)
    {
        // if the manager is not enabled, don't care when an interactable
        // was clicked
        if (!isEnabled_)
        {
            return;
        }


        bool isCollectable = interactables[id].isCollectable;
        bool isInInventory = interactables[id].isInInventory;

        observer.Notify(selectedInteractable, id);

        if (isCollectable && !isInInventory && selectedInteractable == -1)
        {
            interactables[id].isInInventory = true;
            inventory.Add(interactables[id]);
            return;
        }

        if (isCollectable && isInInventory && selectedInteractable == -1)
        {
            selectedInteractable = id;
            return;
        }

        if (selectedInteractable != -1)
        {
            //observer.Notify(selectedInteractable, id);
            return;
        }
    }