Esempio n. 1
0
    private List <StoryData.StoryChoice> getSecretChoices()
    {
        List <StoryData.StoryChoice> choices = new List <StoryData.StoryChoice>();

        foreach (CharacterName character in Enum.GetValues(typeof(CharacterName)))
        {
            if (notesFound.ContainsKey(character) && notesFound[character].Count >= maxNotes)
            {
                StoryData.StoryChoice choice = new StoryData.StoryChoice();
                choice.choiceText  = CharacterData.GetCharacterName(character);
                choice.choiceTexts = new List <TextData> {
                    getQuestion(character)
                };
                choice.linkedStory = getSecretStory(character);

                string storyText = choice.choiceText;

                bool greyOut = storyManager.visitedStories.Contains(choice.linkedStory.storyName);
                if (!greyOut)
                {
                    string colorHex = ColorUtility.ToHtmlStringRGB(GetColor(character));

                    storyText = "<color=#" + colorHex + ">" + storyText + "</color>";
                }
                choice.choiceText = storyText;

                choices.Add(choice);
            }
        }

        if (choices.Count >= 4)
        {
            bool allRead = true;
            foreach (StoryData.StoryChoice newChoice in choices)
            {
                bool greyOut = storyManager.visitedStories.Contains(newChoice.linkedStory.storyName);

                if (!greyOut)
                {
                    allRead = false;
                }
            }
            if (allRead)
            {
                StoryData.StoryChoice choice = new StoryData.StoryChoice();
                choice.choiceText  = "the end";
                choice.choiceTexts = new List <TextData> {
                    finalQuestion, finalQuestion2
                };
                choice.linkedStory = finalSecretStory;
                choices.Add(choice);
            }
        }

        return(choices);
    }
Esempio n. 2
0
 public void askChoice(StoryData.StoryChoice choice, Action postChoiceCallback = null)
 {
     for (int i = 0; i < choice.choiceTexts.Count; ++i)
     {
         Action callback = null;
         if (i == choice.choiceTexts.Count - 1)
         {
             callback = () => { PlayStory(choice.linkedStory); if (postChoiceCallback != null)
                                {
                                    postChoiceCallback();
                                }
             };
         }
         playerText.enqueue(choice.choiceTexts[i], callback);
     }
 }