Ejemplo n.º 1
0
    //This begins the conversation (Called by examplePlayer script)
    public void Begin(VIDE_Assign diagToLoad)
    {
        //First step is to call BeginDialogue, passing the required 'DialogueAssign' component
        //This will store the first Node data in dialogue.nodeData
        dialogue.BeginDialogue(diagToLoad);

        //Let's clean the NPC text variables
        npcText.text = "";
        npcName.text = "";

        //If we already talked to this NPC, lets modify the start of the conversation
        if (dialogue.assigned.interactionCount > 0 && gotItem)
        {
            string name = dialogue.assigned.dialogueName;
            switch (name)
            {
            case "Crazy Cap":
                dialogue.nodeData = dialogue.SetNode(17);
                break;
            }
        }

        //Everytime dialogue.nodeData gets updated, we update our UI with the new data
        UpdateUI();
    }
Ejemplo n.º 2
0
    //This begins the conversation (Called by examplePlayer script)
    public void Begin(VIDE_Assign diagToLoad)
    {
        //First step is to call BeginDialogue, passing the required VIDE_Assign component
        //This will store the first Node data in dialogue.nodeData
        dialogue.BeginDialogue(diagToLoad);


        //Safety check in case a null dialogue was sent
        if (dialogue.assigned == null)
        {
            dialogue.EndDialogue();
            return;
        }

        //Let's clean the NPC text variables
        npcText.text = "";
        npcName.text = "";

        //If we already talked to this NPC, lets modify the start of the conversation
        //Of course, this will be true for particular cases
        //Here, we are using the dialogueName variable of the VIDE_Assign to compare
        if (dialogue.assigned.interactionCount > 0 || LocalDataSingleton.instance.talkedToDragon)
        {
            string name = dialogue.assigned.dialogueName;
            switch (name)
            {
            case "Dragon":
                dialogue.nodeData = dialogue.SetNode(30);     //SetNode allows you to jump to whichever node you want
                if (!LocalDataSingleton.instance.talkedToDragon)
                {
                    LocalDataSingleton.instance.talkedToDragon = true;
                }
                break;
            }
        }

        var data = dialogue.nodeData;

        //Let's specifically check for dynamic text change
        if (!data.currentIsPlayer && data.extraData.Equals("itemLookUp"))
        {
            ItemLookUp(data);
        }
        else if (!data.currentIsPlayer && data.extraData.Equals("RelicLookUp"))
        {
            RelicLookUp(data);
        }

        //Everytime dialogue.nodeData gets updated, we update our UI with the new data
        UpdateUI();
    }