예제 #1
0
 private void displayChoices(List <StoryData.StoryChoice> choices, Action postChoiceCallback = null)
 {
     choiceBox.Clear();
     foreach (StoryData.StoryChoice choice in choices)
     {
         bool greyOut = visitedStories.Contains(choice.linkedStory.storyName);
         choiceBox.AddChoice(choice.choiceText, () => { askChoice(choice, postChoiceCallback); }, greyOut);
     }
 }
예제 #2
0
    public void Update()
    {
        if (StoryManager.isEnding)
        {
            suspendSecretChoice = true;
        }

        if (GameManager.DEBUG)
        {
            CharacterName characterToFake = (CharacterName)(-1);
            if (Input.GetKeyDown(KeyCode.Alpha1))
            {
                characterToFake = CharacterName.arcane;
            }
            else if (Input.GetKey(KeyCode.Alpha2))
            {
                characterToFake = CharacterName.errant;
            }
            else if (Input.GetKey(KeyCode.Alpha3))
            {
                characterToFake = CharacterName.feral;
            }
            else if (Input.GetKey(KeyCode.Alpha4))
            {
                characterToFake = CharacterName.pious;
            }

            if ((int)characterToFake != -1)
            {
                notesFound[characterToFake] = new HashSet <string>()
                {
                    "a", "b", "c"
                };
            }
        }

        float dist = Mathf.Abs(player.transform.position.x - notesPosition.position.x);

        if (dist < notesTriggerDist && !suspendSecretChoice)
        {
            notesUi.Open();
            noteEffect.SetUnread(false);

            if (!secretChoiceBox.IsVisible)
            {
                List <StoryData.StoryChoice> choices = getSecretChoices();
                if (choices.Count > 0)
                {
                    secretChoiceBox.show();
                    secretChoiceBox.Clear();
                    foreach (StoryData.StoryChoice choice in choices)
                    {
                        string storyText = choice.choiceText;
                        bool   greyOut   = storyManager.visitedStories.Contains(choice.linkedStory.storyName);

                        secretChoiceBox.AddChoice(storyText, () => { suspendSecretChoice = true;                         // close the notes until we leave & return
                                                                     storyManager.Abort();  storyManager.askChoice(choice); }, greyOut);
                    }
                }
            }
        }
        else
        {
            if (dist > UnsuspendSecretChoiceDist)
            {
                suspendSecretChoice = false;
            }

            notesUi.Close();
            secretChoiceBox.hide();
            secretChoiceBox.Clear();
        }
    }