Esempio n. 1
0
    }//End SpeakingNPC Getter

    //Find a conversation with the given game state
    public static Conversation findConversation(SpeakingNPC npc)
    {
        bool spoken;

        spoken = GameState.interactedWithAtLeastOnce[npc.speakerID];
        foreach (Conversation conversation in conversations.Values)
        {
            if (conversation.speakerID.Equals(npc.speakerID))
            {
                if (spoken)
                {
                    if (conversation.conversationID.Equals(npc.speakerID + "NonFirstConversation"))
                    {
                        Debug.Log("Non-First Conversation with " + npc.speakerID + " found: " + conversation.conversationID);
                        return(conversation);
                    } //End if
                }     //End if
                else
                {
                    if (conversation.conversationID.Equals(npc.speakerID + "FirstConversation"))
                    {
                        Debug.Log("First Conversation with " + npc.speakerID + " found: " + conversation.conversationID);
                        return(conversation);
                    } //End if
                }     //End else
            }         //End if
        }             //End foreach
        Debug.LogError("Conversation could not be found for " + npc.speakerID + " with the \"spoken before\" status of " + spoken + ".");
        return(null);
    }//End findConversationWithGameState
Esempio n. 2
0
    }//End Awake

    public CurrentDialogue(Line line, SpeakingNPC npc)
    {
        //Set up all CurrentDialogue variables with Line data
        currentLine  = line.text;
        currentName  = npc.speakerName;
        currentImage = npc.portrait;
        textBlip     = npc.voice;
    }//End Constructor
Esempio n. 3
0
    }//End Player Speaking Display Getter

    #endregion

    private void Start()
    {
        //Create blank currentDialogue
        currentDialogue = null;
        //Get the player speaker data
        playerData = JSONHolder.getSpeaker("Player");
        //Get the portrait, name, and line objects from the UI
        for (int i = 0; i < convoHUDObject.transform.childCount; i++)
        {
            var child = convoHUDObject.transform.GetChild(i);
            switch (child.name)
            {
            case "NPC Dialogue Box":
                npcSpeakingDisplay = child.gameObject;
                for (int j = 0; j < npcSpeakingDisplay.transform.childCount; j++)
                {
                    var npcChild = npcSpeakingDisplay.transform.GetChild(j);
                    switch (npcChild.name)
                    {
                    case "Portrait": portraitNPCDisplay = npcChild.gameObject.GetComponent <Image>(); break;

                    case "Name": speakerNameNPCDisplay = npcChild.gameObject.GetComponent <TextMeshProUGUI>(); break;

                    case "Line": lineInBoxNPCDisplay = npcChild.gameObject.GetComponent <TextMeshProUGUI>(); break;
                    } //End switch
                }     //End for
                break;

            case "Player Choices":
                playerSpeakingDisplay = child.gameObject;
                var playerDialogueBox = playerSpeakingDisplay.transform.GetChild(0);
                for (int j = 0; j < playerDialogueBox.transform.childCount; j++)
                {
                    var playerChild = playerDialogueBox.transform.GetChild(j);
                    switch (playerChild.name)
                    {
                    case "Portrait":
                        portraitPlayerDisplay = playerChild.gameObject.GetComponent <Image>();
                        setPlayerPortrait(playerData.portrait);
                        break;

                    case "Name":
                        speakerNamePlayerDisplay = playerChild.gameObject.GetComponent <TextMeshProUGUI>();
                        setPlayerName(playerData.speakerName);
                        break;

                    case "Line":
                        lineInBoxPlayerDisplay = playerChild.gameObject.GetComponent <TextMeshProUGUI>();
                        setPlayerLineInBox("");
                        break;
                    } //End switch
                }     //End for
                break;
            }//End switch
        }//End for
        playerSpeakingDisplay.SetActive(false);
        npcSpeakingDisplay.SetActive(false);
    }//End Start
Esempio n. 4
0
 //Get the values that will always need to be carried by the dialogue manager
 private void Start()
 {
     nextPressed        = false;
     currentIndex       = -1;
     finishedLine       = false;
     conversationIsOver = true;
     playerData         = JSONHolder.getSpeaker("Player");
     uiManager          = GameObject.FindGameObjectWithTag("HUD").GetComponent <UIManager>();
     audioSource        = GameObject.FindGameObjectWithTag("Audio Source").GetComponent <AudioSource>();
 }//End Start
Esempio n. 5
0
    }//End Line Getter

    //Find and return a specific speaker
    public static SpeakingNPC getSpeaker(string speakerID)
    {
        int index = 0;

        SpeakingNPC[] speakingNPCsToSearch = new SpeakingNPC[speakers.Count];
        speakers.Values.CopyTo(speakingNPCsToSearch, index);
        //Check if the speaker ID exists anywhere in the dictionary
        while (index < speakingNPCsToSearch.Length)
        {
            if (speakingNPCsToSearch[index].speakerID.Equals(speakerID))
            {
                return(speakingNPCsToSearch[index]);
            }//End if
            else
            {
                index++;
            } //End else
        }     //End while
        Debug.LogError("Speaker with ID " + speakerID + " not found.");
        return(null);
    }//End SpeakingNPC Getter
Esempio n. 6
0
    }     //End Type enumerator

    public void speakerIsPlayer(SpeakingNPC playerData)
    {
        currentImage = playerData.portrait;
        currentName  = playerData.speakerName;
        textBlip     = playerData.voice;
    }//End speakerIsPlayer
Esempio n. 7
0
    }//End LineInBox Setter

    //NPC Speaker Data Setter
    public void setNPCData(SpeakingNPC npcData)
    {
        this.npcData = npcData;
    }//End NPC Data Setter