Ejemplo n.º 1
0
    private void ClickOnStructureInventory()
    {
        if (!playerState.currentInteract || !playerState.isInStructure)
        {
            print("!playerState.currentInteract");
            return;
        }
        StructureCreator structureCreator = playerState.currentInteract.GetComponent <StructureCreator>();

        if (playerState.checkFull())
        {
            playerState.helpText = "Your inventory is full!";
            playerState.updateHelpText.Raise();
            return;
        }

        GameObject itemFromInventory = structureCreator.structureState.findItemByName(gameObject.name.Substring("Image_".Length));

        if (!itemFromInventory)
        {
            print("PlayerItemUI: itemFromInventory non trovato");
            return;
        }

        playerState.AddItem(itemFromInventory);
        structureCreator.structureState.RemoveItem(itemFromInventory);
        playerState.updateInventoryUI.Raise();
    }
Ejemplo n.º 2
0
    private void ClickOnPlayerInventory()
    {
        if (!playerState.currentInteract)
        {
            playerState.helpText = "Item released on the ground!";
            playerState.updateHelpText.Raise();
            playerState.clickedObjName = gameObject.name.Substring("Image_".Length);
            playerState.playerReleaseItem.Raise();
            return;
        }
        if (!playerState.isInStructure)
        {
            return;
        }

        StructureCreator structureCreator = playerState.currentInteract.GetComponent <StructureCreator>();

        if (structureCreator.structureState.checkFull())
        {
            playerState.helpText = "The inventory of this structure is full!";
            playerState.updateHelpText.Raise();
            return;
        }

        GameObject itemFromInventory = playerState.findItemByName(gameObject.name.Substring("Image_".Length));

        if (!itemFromInventory)
        {
            print("PlayerItemUI: itemFromInventory non trovato");
            return;
        }

        playerState.RemoveItem(itemFromInventory);
        structureCreator.structureState.AddItem(itemFromInventory);
        playerState.updateInventoryUI.Raise();
    }