Exemple #1
0
        public void UsingTheDialogueRunner()
        {
            RelayTwo relay = new RelayTwo();

            relay.CreateTable(DialogueNode.TABLE_NAME);
            DialogueRunner runner = new DialogueRunner(relay, Language.SWEDISH);

            runner.AddOnSomeoneSaidSomethingListener(LogDialogue);
            _dialogueLog = new List <string>();

            TimedDialogueNode d1 = runner.Create <TimedDialogueNode>("FirstConverstation", Language.SWEDISH, "DialogueNode1");

            d1.nextNode = "DialogueNode2";
            d1.timer    = 0.5f;
            d1.speaker  = "Helan";
            d1.line     = "Hi, what's up?";

            TimedDialogueNode d2 = runner.Create <TimedDialogueNode>("FirstConverstation", Language.SWEDISH, "DialogueNode2");

            d2.speaker = "Halvan";
            d2.line    = "I'm fine, thanks";

            // Frame 0
            d1.Start();

            Assert.IsTrue(d1.isOn);
            Assert.IsFalse(d2.isOn);

            runner.LogNodesThatAreOn();

            // Frame 1
            runner.Update(0.2f);
            runner.Update(0.2f);
            runner.Update(0.2f);
            runner.Update(0.2f);

            runner.LogNodesThatAreOn();

            Assert.IsFalse(d1.isOn);
            Assert.IsTrue(d2.isOn);
        }
        public void UsingTheDialogueRunner()
        {
            RelayTwo relay = new RelayTwo();
            relay.CreateTable(DialogueNode.TABLE_NAME);
            DialogueRunner runner = new DialogueRunner(relay, Language.SWEDISH);
            runner.AddOnSomeoneSaidSomethingListener(LogDialogue);
            _dialogueLog = new List<string>();

            TimedDialogueNode d1 = runner.Create<TimedDialogueNode>("FirstConverstation", Language.SWEDISH, "DialogueNode1");
            d1.nextNode = "DialogueNode2";
            d1.timer = 0.5f;
            d1.speaker = "Helan";
            d1.line = "Hi, what's up?";

            TimedDialogueNode d2 = runner.Create<TimedDialogueNode>("FirstConverstation", Language.SWEDISH, "DialogueNode2");
            d2.speaker = "Halvan";
            d2.line = "I'm fine, thanks";

            // Frame 0
            d1.Start();

            Assert.IsTrue(d1.isOn);
            Assert.IsFalse(d2.isOn);

            runner.LogNodesThatAreOn();

            // Frame 1
            runner.Update(0.2f);
            runner.Update(0.2f);
            runner.Update(0.2f);
            runner.Update(0.2f);

            runner.LogNodesThatAreOn();

            Assert.IsFalse(d1.isOn);
            Assert.IsTrue(d2.isOn);
        }