Example #1
0
 private void Start()
 {
     questionButtons   = new List <QuestionButton>();
     accusationButtons = new List <QuestionButton>();
     knowledgeButton.onClick.AddListener(() => { QuestionHandler.ProbeClue(new Clue("Knowledge", "Preliminary knowledge the character knows.")); });
     //AddClue("Case", new Clue("Knowledge", ""));
     //questionButtons.Add(new QuestionButton(questionCloseButton, new Clue()));
     print(DialogueHandler.GetCulpritName());
 }
    /// <summary>
    /// Accuses the last character talked to of the murder.
    /// </summary>
    /// <param name="accusationBasis">The Clue that the player determined as the reason for the murder.</param>
    public void AccuseCharacter(Clue accusationBasis)
    {
        // Check if we have the right tags first.
        string[] requiredAccusationTags = DialogueHandler.GetRequiredAccusationClueTags();

        // Since we only need to accuse one clue and have to have the other unlocked, make sure
        // we passed in one of them and have them unlocked in the Journal.
        if (requiredAccusationTags.Contains(accusationBasis.ClueTag))
        {
            // We passed in a correct clue, now let's make sure we have them unlocked in the journal.
            foreach (string tag in requiredAccusationTags)
            {
                if (!Journal.Instance.HasDiscoveredClue(tag))
                {
                    IncorrectAccusation(accusationBasis);
                    return;
                }
            }
        }
        // We didn't pass in a correct clue to begin with, so
        // automatically an incorrect accusation.
        else
        {
            IncorrectAccusation(accusationBasis);
            return;
        }

        // We passed in the right clues. Now let's make sure we are accusing the right character!
        string characterAccused = NPCInteraction.activeCharacter.Name;
        string culpritName      = DialogueHandler.GetCulpritName();

        // The name's match! We chose correctly.
        if (characterAccused == culpritName)
        {
            CorrectAccusation(accusationBasis);
        }
        // The name's mismatched, so incorrect accusation.
        else
        {
            IncorrectAccusation(accusationBasis);
        }
    }
    private void CorrectAccusation(Clue clue)
    {
        string result = "You made the right accusation! " + NPCInteraction.activeCharacter.Name + " == " + DialogueHandler.GetCulpritName() + " is the culprit!\n";

        result += "Clue passed in: " + clue.ClueTag;

        HandleEndGame(true);
    }