コード例 #1
0
    /// <summary>
    /// e.g. for showItem sequence, also for use in dialogue
    /// </summary>
    /// <param name="itemObject"></param>
    public void HandleItemReceive(Script_ItemObject itemObject, Script_Player player)
    {
        Script_Item item = itemObject.Item;

        Debug.Log($"{name} Adding item: {item}");
        bool pickUpSuccess = game.AddItem(item);

        if (!pickUpSuccess)
        {
            // handle flow to drop an item in inventory
        }

        Script_ItemsEventsManager.ItemPickUp(item.id);

        // Display item above Player's head.
        player.SetIsPickingUp(item);
        player.ItemPickUpEffect(true, item);

        /// Item theatrics here
        if (itemObject.pickUpTheatricsPlayer != null)
        {
            itemObject.pickUpTheatricsPlayer.Play();
            return;
        }

        Script_Game.Game.dialogueManager.StartDialogueNode(
            itemObject.GetComponent <Script_DialogueNode>()
            );

        if (!itemObject.showTyping)
        {
            Debug.Log("Skipping typing item initial description on receiving item");
            Script_Game.Game.dialogueManager.SkipTypingSentence();
        }
    }