public void RecieveDialogueBranch(DialogueBranch newBranch)
 {
     // Add branch info here
     this.branch  = newBranch;
     responses    = Mathf.Clamp(branch.ResponseOption.Count, 0, 3);
     currentIndex = 0;
 }
Example #2
0
    private void Start()
    {
        gameManager = GameManager.Instance;

        //dialogueBranch = DialogueBranch.Instance;
        //branchIndex = 0;    // Replace this with GameManager's loadBranchIndex

        branchIndex = gameManager.loadBranchIndexForNextScene;

        currDialogueBranch = dialogueBranches[branchIndex];

        //choiceSetIndex = 0;
        choiceSetIndex = gameManager.loadChoiceIndexForNextScene;
        currChoiceSet  = choiceSets[choiceSetIndex];

        sentences = new Queue <string>();

        //textColorDaughter = new Color(255, 180, 60);
        //textColorDad = new Color(8, 255, 100);

        dialogueText.text = "";
        continueButton.SetActive(false);

        settingText.text = setting;

        settingText.gameObject.GetComponent <Animator>().Play("Fade_InAndOut");
        PlayFadeAnimation("Fade_FromBlack");    // About 5 seconds long


        Invoke("TriggerDialogue", 5f);
    }
Example #3
0
        // Load a Dialogue box
        public static DialogueBoxPlain LoadDialogueBoxPlain(StreamReader reader, DialogueBranch group)
        {
            DialogueBoxPlain box = new DialogueBoxPlain(group);

            string line;

            while ((line = GetLine(reader)) != "---")
            {
                switch (line)
                {
                case "Text":
                    box.Text = GetLine(reader).Replace("|", "\n");
                    break;

                case "TextSpeed":
                    box.UpdateSpeed = float.Parse(GetLine(reader), CultureInfo.InvariantCulture);
                    break;

                case "NonSkippable":
                    box.Skippable = false;
                    break;

                case "TextType":
                    box.textType = (DialogueBoxPlain.TextType)Enum.Parse(typeof(DialogueBoxPlain.TextType), GetLine(reader));
                    break;
                }
            }
            return(box);
        }
Example #4
0
        // Load Dialogue box group
        public static void LoadDialogueBranch(StreamReader reader, Dialogue d)
        {
            DialogueBranch branch = new DialogueBranch(d);
            string         Key    = "";

            string line;

            while ((line = GetLine(reader)) != "---")
            {
                switch (line)
                {
                case "DialogueBoxPlain":
                    branch.Boxes.Add(LoadDialogueBoxPlain(reader, branch));
                    break;

                case "DialogueBoxAlternativePlain":
                    branch.Boxes.Add(LoadDialogueBoxAlternativePlain(reader, branch));
                    break;

                case "Key":
                    Key = GetLine(reader);
                    break;
                }
            }
            d.DialogueBranches.Add(Key, branch);
        }
Example #5
0
    public void SetCurrentDialogueBranch(int branchInt) // Set in Choice A/B OnClick() event
    {
        branchIndex        = branchInt;
        currDialogueBranch = dialogueBranches[branchInt];

        ChangeTextColor();
    }
    private DialogueNode GenBranch2(long id = 2, long next = 1)
    {
        DialogueBranch output = dialogueContext.CreateDialogueBranch(id, next);

        output
        .AddNode(new DialogueSpeech("You are pretty slow now, aren't ya?"))
        .AddNode(new DialogueSpeech(""));
        return(output);
    }
        private void AddBranchData(DialogueBranch branch)
        {
            var branchItem = new DarkListItem(branch.Name)
            {
                Tag = branch
            };

            this.lstBranches.Items.Add(branchItem);
        }
Example #8
0
    public static void StartConversation(DialogueBranch branch)
    {
        if (!CheckState(GameState.Conversation))
        {
            GameState = GameState.Conversation;

            CurrentBranch = branch;
            CurrentIndex  = 0;
            instance.dialogueHandler.OpenAndStartConvo();
        }
    }
    private DialogueNode GenBranch3(long id = 3, long next = -1)
    {
        DialogueBranch output = dialogueContext.CreateDialogueBranch(id++, next);

        output
        .AddEffect()
        .AddHandler(new DialogueEffectPlayMusicHandler(0));
        output
        .AddNode(new DialogueSpeech("Thank you for reading :)", "Daratrix the weakburger"))
        .AddNode(new DialogueSpeech("(The next click will end the game...)"));
        return(output);
    }
Example #10
0
    private DialogueNode GenBranch0(long id = 0, long next = 1)
    {
        DialogueBranch output = dialogueContext.CreateDialogueBranch(id, next);

        output
        .AddNode(new DialogueSpeech("(Hit [Left clic] or [Space] to progress...)")
                 .AddEffect()
                 .AddHandler(new DialogueEffectSetAudioClipHandler(0))
                 .AddHandler(new DialogueEffectSetAudioClipSourceHandler(0, "SoftDialogueExample/Audio/Intro"))
                 .AddHandler(new DialogueEffectSetAudioClipHandler(1))
                 .AddHandler(new DialogueEffectSetAudioClipSourceHandler(1, "SoftDialogueExample/Audio/MainTheme"))
                 .AddHandler(new DialogueEffectSetAudioClipHandler(2))
                 .AddHandler(new DialogueEffectSetAudioClipSourceHandler(2, "SoftDialogueExample/Audio/BatHitMiss"))
                 .AddHandler(new DialogueEffectSetSpriteHandler(3))
                 .AddHandler(new DialogueEffectSetSpriteSourceHandler(3, "SoftDialogueExample/Sprites/Doge"))
                 .AddHandler(new DialogueEffectSetSpriteSizeHandler(3, new Vector2(1, 1)))
                 .AddHandler(new DialogueEffectSnapSpriteToPositionHandler(3, new Vector3(0, 0), SpriteSnapPosition.Bottom)))
        .AddNode(new DialogueSpeech("...")
                 .AddEffect()
                 .AddHandler(new DialogueEffectPlayAudioHandler(2))
                 .AddHandler(new DialogueEffectSetSpriteVisibleHandler(3, true)))
        .AddNode(new DialogueSpeech("This is a sample.")
                 .AddEffect()
                 .AddHandler(new DialogueEffectPlayAudioHandler(2))
                 .AddHandler(new DialogueEffectFlipSpriteHandler(3, true, false))
                 .AddHandler(new DialogueEffectWaitHandler(0.1f))
                 .AddHandler(new DialogueEffectPlayAudioHandler(2))
                 .AddHandler(new DialogueEffectFlipSpriteHandler(3, false, false))
                 .AddHandler(new DialogueEffectWaitHandler(0.1f))
                 .AddHandler(new DialogueEffectPlayAudioHandler(2))
                 .AddHandler(new DialogueEffectFlipSpriteHandler(3, true, false))
                 .AddHandler(new DialogueEffectWaitHandler(0.1f))
                 .AddHandler(new DialogueEffectPlayAudioHandler(2))
                 .AddHandler(new DialogueEffectFlipSpriteHandler(3, false, false)))
        .AddNode(new DialogueSpeech("...")
                 .AddEffect()
                 .AddHandler(new DialogueEffectPlayAudioHandler(2))
                 .AddHandler(new DialogueEffectScaleSpriteHandler(3, 0.3f, new Vector2(0.1f, 0.1f)))
                 .AddHandler(new DialogueEffectMoveSpriteHandler(3, 0.3f, new Vector3(10, 0, 0), SpriteSnapPosition.Bottom))
                 .AddHandler(new DialogueEffectWaitHandler(0.4f)))
        .AddNode(new DialogueSpeech("Let's get to it already!!!")
                 .AddEffect()
                 .AddHandler(new DialogueEffectPlayAudioHandler(2))
                 .AddHandler(new DialogueEffectSetSpriteVisibleHandler(3, false)))
        .AddNode(new DialogueSpeech("")
                 .AddEffect()
                 .AddHandler(new DialogueEffectSetConditionHandler("FIRST")));

        return(output);
    }
Example #11
0
    private DialogueNode GenerateFugitive(long id)
    {
        DialoguePassiveChoice root = dialogueContext.CreateDialoguePassiveChoice(id);

        root.AddOption(new DialoguePassiveOption(id + 1, new string[] { "!fugitive" }));
        root.AddOption(new DialoguePassiveOption(id + 4, new string[] { "fugitive" }));
        DialogueBranch firstEncounter = dialogueContext.CreateDialogueBranch(id + 1, id + 2);

        firstEncounter.AddEffect().AddHandler(new DialogueEffectSetConditionHandler("fugitive"));
        firstEncounter
        .AddNode(new DialogueSpeech("You... you..."))
        .AddNode(new DialogueSpeech("Oh, I'm so sorry..."))
        .AddNode(new DialogueSpeech("Such a waste..."))
        .AddNode(new DialogueSpeech("I'm not going to make it. Please, I beg you, hear me out."))
        .AddNode(new DialogueSpeech("I have a favour to ask of you."));

        DialogueActiveChoice firstEncounterChoice = dialogueContext.CreateDialogueActiveChoice(id + 2);

        firstEncounterChoice
        .AddOption(new DialogueActiveOption(id + 3, "Accept"))
        .AddOption(new DialogueActiveOption(id + 4, "Decline"));

        DialogueBranch firstEncounterAccept = dialogueContext.CreateDialogueBranch(id + 3, -1);

        firstEncounterAccept
        .AddEffect(new DialogueConditionalEffect()).AddCondition("!fugitiveAccept")
        .AddHandler(new DialogueEffectSetConditionHandler("fugitiveAccept"));
        firstEncounterAccept
        .AddNode(new DialogueSpeech("Oh..."))
        .AddNode(new DialogueSpeech("I thank you, from the bottom of my heart..."))
        .AddNode(new DialogueSpeech("Someone will come to claim me."))
        .AddNode(new DialogueSpeech("They will be here soon..."))
        .AddNode(new DialogueSpeech("Don't trust them."))
        .AddNode(new DialogueSpeech("Whatever they say to you, don't ever trust them."))
        .AddNode(new DialogueSpeech("Oppose them!"))
        .AddNode(new DialogueSpeech("They will trick you in doing... unspeakable things..."))
        .AddNode(new DialogueSpeech("Don't end..."))
        .AddNode(new DialogueSpeech("... like me..."));
        DialogueBranch firstEncounterDecline = dialogueContext.CreateDialogueBranch(id + 4, -1);

        firstEncounterDecline
        .AddEffect(new DialogueConditionalEffect()).AddCondition("!fugitiveDecline")
        .AddHandler(new DialogueEffectSetConditionHandler("fugitiveDecline"));
        firstEncounterDecline
        .AddNode(new DialogueSpeech("Oh, please..."))
        .AddNode(new DialogueSpeech("Don't be tricked..."))
        .AddNode(new DialogueSpeech("Save... yourself..."));
        return(root);
    }
Example #12
0
    private DialogueNode GenerateStranger(long id)
    {
        DialoguePassiveChoice root = dialogueContext.CreateDialoguePassiveChoice(id);

        root.AddOption(new DialoguePassiveOption(id + 1, new string[] { "!stranger" }));
        root.AddOption(new DialoguePassiveOption(id + 4, new string[] { "stranger" }));
        DialogueBranch firstEncounter = dialogueContext.CreateDialogueBranch(id + 1, id + 2);

        firstEncounter.AddEffect().AddHandler(new DialogueEffectSetConditionHandler("stranger"));
        firstEncounter
        .AddNode(new DialogueSpeech("Well, what do we have here?"))
        .AddNode(new DialogueSpeech("You've trapped yourself down here, have you not?"))
        .AddNode(new DialogueSpeech("A pity... You shouldn't go down a pit without thinking."));

        DialogueActiveChoice firstEncounterChoice = dialogueContext.CreateDialogueActiveChoice(id + 2);

        firstEncounterChoice
        .AddOption(new DialogueActiveOption(id + 3, "Accept"))
        .AddOption(new DialogueActiveOption(id + 4, "Decline"));

        DialogueBranch firstEncounterAccept = dialogueContext.CreateDialogueBranch(id + 3, -1);

        firstEncounterAccept
        .AddEffect(new DialogueConditionalEffect()).AddCondition("!fugitiveAccept")
        .AddHandler(new DialogueEffectSetConditionHandler("fugitiveAccept"));
        firstEncounterAccept
        .AddNode(new DialogueSpeech("Oh..."))
        .AddNode(new DialogueSpeech("I thank you, from the bottom of my heart..."))
        .AddNode(new DialogueSpeech("Someone will come to claim me."))
        .AddNode(new DialogueSpeech("They will be here soon..."))
        .AddNode(new DialogueSpeech("Don't trust them."))
        .AddNode(new DialogueSpeech("Whatever they say to you, don't ever trust them."))
        .AddNode(new DialogueSpeech("Oppose them!"))
        .AddNode(new DialogueSpeech("They will trick you in doing... unspeakable things..."))
        .AddNode(new DialogueSpeech("Don't end..."))
        .AddNode(new DialogueSpeech("... like me..."));
        DialogueBranch firstEncounterDecline = dialogueContext.CreateDialogueBranch(id + 4, -1);

        firstEncounterDecline
        .AddEffect(new DialogueConditionalEffect()).AddCondition("!fugitiveDecline")
        .AddHandler(new DialogueEffectSetConditionHandler("fugitiveDecline"));
        firstEncounterDecline
        .AddNode(new DialogueSpeech("Oh, please..."))
        .AddNode(new DialogueSpeech("Don't be tricked..."))
        .AddNode(new DialogueSpeech("Save... yourself..."));
        return(root);
    }
Example #13
0
        public Enemy(GameScreen gameScreen) : base(gameScreen)
        {
            HitBox      hitBox   = new HitBox(this);
            BoxCollider collider = new BoxCollider();

            collider.Size   = new Vector2(17, 40);
            collider.Offset = new Vector2(-10, -16);
            hitBox.SetCollider(collider);
            AddComponent(hitBox);

            Physics physics = new Physics(this);

            AddComponent(physics);
            physics.Solid          = true;
            physics.GravityEnabled = true;

            Sprite sprite = new Sprite(this);

            AddComponent(sprite);
            sprite.SpriteOffset = new Vector2(-24, -24);
            sprite.AddTexture(gameScreen.Content, "Images/Sprites/Enemy/gravling");

            Dialogue dialogue = new Dialogue(this);

            DialogueBranch dialogueBranch = new DialogueBranch(dialogue);

            dialogue.AddDialogueBranch("", dialogueBranch);

            DialogueBox dialogueBox = new DialogueBox(dialogueBranch);

            dialogueBranch.AddDialogueBox(dialogueBox);
            dialogueBox.skipable  = true;
            dialogueBox.textSpeed = 0.01f;
            dialogueBox.SetText("Satans POTATis!\nMy name jefffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");

            DialogueBox dialogueBox2 = new DialogueBox(dialogueBranch);

            dialogueBox2.skipable = true;
            dialogueBranch.AddDialogueBox(dialogueBox2);
            dialogueBox2.textSpeed = .5f;
            dialogueBox2.SetText("lmao lmao lmao lmao lmao lmao\nlmao lmao lmao lmao lmao lmao\nlmao lmao lmao lmao lmao lmao");

            ObjectComponents.Add(dialogue);

            HP = 200;
        }
Example #14
0
    private DialogueNode GenBranch1(long id = 1, long next = 10)
    {
        DialogueBranch output = dialogueContext.CreateDialogueBranch(id, next);

        output
        .AddEffect()
        .AddHandler(new DialogueEffectPlayMusicHandler(0));
        output
        .AddNode(new DialogueSpeech("The cold night wind is softly blowing. A fine rain is slowly turning the streets wet."))
        .AddNode(new DialogueSpeech("Sometimes, the bright frontlight of some car enlighten the dark concrete."))
        .AddNode(new DialogueSpeech("Nobody's walking here by that time and weather."))
        .AddNode(new DialogueSpeech("But I do. I love the peaceful ambiance."))
        .AddNode(new DialogueSpeech("The quiet environment is perfect to reflect on my recent life decisions."))
        .AddNode(new DialogueSpeech("My head is empty from the harsh thoughts that cloud my spirit during my day to day life."))
        .AddNode(new DialogueSpeech("But maybe it's not clear. Do you want me to repeat myself?"));
        return(output);
    }
        private void ButtonAddBranch_Click(object sender, EventArgs e)
        {
            // Figure out the branch name
            string branchName = "Branch";
            int    branchNum  = 0;

            while (_dialogue.BranchExists($"{branchName}{branchNum}"))
            {
                branchNum++;
            }

            branchName = $"{branchName}{branchNum}";

            var branch = new DialogueBranch(_dialogue, branchName, "Enter your branch text here...");

            _dialogue.AddBranch(branch);

            this.AddBranchData(branch);
        }
        private void OnBranchSelected(DialogueBranch branch)
        {
            _selectedBranch = branch;
            this.branchPanel.Show();

            this.txtBranchText.Text = branch.Text;

            this.lstResponses.Items.Clear();

            foreach (var response in branch.Responses)
            {
                this.AddResponseData(response);
            }

            if (branch.Responses.Count > 0)
            {
                this.lstResponses.SelectItem(0);
            }
        }
Example #17
0
        // Load a plain choice box
        public static DialogueBoxAlternativePlain LoadDialogueBoxAlternativePlain(StreamReader reader, DialogueBranch group)
        {
            DialogueBoxAlternativePlain box = new DialogueBoxAlternativePlain(group);

            string line;

            while ((line = GetLine(reader)) != "---")
            {
                switch (line)
                {
                case "Alternative":
                    box.Alternatives.Add(LoadAlternative(reader));
                    break;
                }
            }
            return(box);
        }