Esempio n. 1
0
 public void Start()
 {
     story.OnStoryLoaded = ((s) =>
     {
         _runtime = new TwisonRuntime(s.story, new TwisonTagFilterBehaviour(), true);
         ApplyStoryUpdate();
     });
 }
        public void TestCreateRuntime()
        {
            var story   = new TwisonLoader().Load(ExampleStory);
            var tracker = new TwisonTagFilterBehaviour();
            var runtime = new TwisonRuntime(story, tracker, true);

            Assert.AreEqual(runtime.FindByName("Dialog.VillagerGeneric1.Hello"), runtime.Active);
        }
        public void TestFilteredLinksBehaviour()
        {
            var story   = new TwisonLoader().Load(ExampleStory);
            var tracker = new TwisonTagFilterBehaviour();
            var runtime = new TwisonRuntime(story, tracker, true);

            // Before seeing restricted tag, cannot see link
            Assert.False(runtime.Links.Any(i => i.name == "North forest"));

            // Act
            Assert.True(runtime.GoToPassage("Rumors"));
            Assert.True(runtime.GoToPassage("Goblins"));
            Assert.True(runtime.GoToPreviousPassage());
            Assert.True(runtime.GoToPreviousPassage());
            Assert.AreEqual(runtime.Active.name, "Dialog.VillagerGeneric1.Hello");

            // Assert: After seeing tag, can see link
            Assert.True(runtime.Links.Any(i => i.name == "North forest"));
        }