コード例 #1
0
        public void InitSleepingHobby()
        {
            StoryNode mother = new StoryNode("My mother was a nice cat. She was big and fluffy, " +
                                             "not at all like my father. I only saw my father for a moment just seconds after I was old " +
                                             "enough to open my eyes. Male cats don't stick around too long, you see. We're not generally very interested in raising kittens. " +
                                             "Anyway, my mother's name was Diamond.", container.UpdateImageAction(FOUR));

            StoryNode dreams = new StoryNode("I suppose the most interesting dream I've ever had was one where I was a fish. " +
                                             "I was swimming in circles in an aquarium, around a little plastic treasure chest, just like the one in the aquarium over in the living room. " +
                                             "You should look at it sometime. It's very peaceful. In my dream the hand appeared and sprinkled some pellets into the aquarium. " +
                                             "I swam up to eat them, but when I drew close I saw that the pellets were actually eyeballs. Then I woke up.", () => {
                container.View.UpdateImage(catImages[FIVE]);
            });


            hobbiesSleeping.AddInputBasedTransition("(mother|mom)".MatchSomewhere(), mother);
            hobbiesSleeping.AddInputBasedTransition("dream".MatchSomewhere(), dreams);
            hobbiesSleeping.AddHint(new StoryNode("It's no good... you've got me thinking about my mother... and dreams.", container.UpdateImageAction(TEN))
                                    );

            mother.AddInputBasedTransition("dream".MatchSomewhere(), hobbiesSleeping);
            dreams.AddInputBasedTransition("(mother|mom)".MatchSomewhere(), hobbiesSleeping);

            mother.GraftLoop(new StoryNode("Sorry. Bit spaced out. Thinking of my mom does that to me."), new StoryNode(string.Format("<--{0} is thinking about his mother.-->", catName)));
            dreams.GraftLoop(new StoryNode("Dreams are pretty strange. I wonder if other animals have them."), new StoryNode(string.Format("<--{0}'s just staring into space-->", catName)));
        }
コード例 #2
0
        public void InitRiddle()
        {
            StoryNode riddleNotBestFriend             = new StoryNode("Riddle was not my best friend, by any stretch of the imagination. But after awhile he became my only friend, and that's close enough.");
            StoryNode sadThingsHappenedToOtherFriends = new StoryNode("Sad things happened to my other friends. I grew up between a road and a park. Cars and coyotes. Lots of cats died.");
            StoryNode weHunted = new StoryNode("Mostly, Riddle and I hunted. Riddle liked hunting better than I did. I didn't see a point.");
            StoryNode huntingIsDumbWeWereHousecats = new StoryNode("Both of us were housecats. We were being fed every day. What need was there to hunt?");
            StoryNode huntedGrasshoppers           = new StoryNode("We mostly hunted grasshoppers. There weren't a lot of mice, surprisingly. Maybe the coyotes scared them away.");
            StoryNode kazAvoidedBirds         = new StoryNode("I avoided birds. The woman I live with hit me if I ever killed a bird.");
            StoryNode riddleLikedGrassHoppers = new StoryNode("Riddle swore that grasshoppers tasted better than cat food.");
            StoryNode riddleWasObnoxious      = new StoryNode("I considered Riddle a bit obnoxious. He was very proud of himself, and I didn't think he was justified in that.");
            StoryNode riddleDidntLikeMeEither = new StoryNode("I don't think Riddle liked me very much, either.");
            StoryNode riddleWantedCompany     = new StoryNode("I think Riddle wanted company. Everyone wants company sometimes, especially when things are sad.");
            StoryNode dontHateRiddle          = new StoryNode("I don't hate Riddle. But I don't have any interest in speaking to him. I don't think he's interested in speaking to me, either.");
            StoryNode riddleHangsAroundWindow = new StoryNode("Riddle hangs around the window sometimes.");

            riddle.AddFreeTransition(riddleNotBestFriend);
            riddleNotBestFriend.AddInputBasedTransition("(do|common|get along)".MatchSomewhere(), weHunted);
            weHunted.GraftStep("(why|what.*//?|how come)".MatchSomewhere(), huntingIsDumbWeWereHousecats);
            riddleNotBestFriend.GraftStep("(other|what.*//?|why?|friend)".MatchSomewhere(), sadThingsHappenedToOtherFriends);
            weHunted.AddInputBasedTransition("(what|hunt|catch|kill|go (for|after))".MatchSomewhere(), huntedGrasshoppers);
            huntedGrasshoppers.GraftStep("(gross|disgusting|e+w|sick)".MatchSomewhere(), new StoryNode("Yeah, I know. Look -Riddle- liked grasshoppers. Not me."));
        }
コード例 #3
0
        public void InitWindow()
        {
            hobbiesWindow.effectUponReaching = container.UpdateImageAction(3);
            StoryNode sawSomethingInteresting = new StoryNode("There was a time... I saw something very interesting.", container.UpdateImageAction(ONE));

            sawSomethingInteresting.GraftStep(new StoryNode(string.Format("<--{0} has a faraway look in his eyes -->", catName), container.UpdateImageAction(FIVE)));
            hobbiesWindow.GraftStep(sawSomethingInteresting);

            hobbiesWindow.AddHint(new StoryNode("No one ever wants to hear about the most interesting thing I've seen.", container.UpdateImageAction(TWO)));

            StoryNode sawAnotherCat  = new StoryNode("I saw another cat.", container.UpdateImageAction(ZERO));
            StoryNode sawAnotherCat1 = new StoryNode("It was long and black.", container.UpdateImageAction(ONE));
            StoryNode sawAnotherCat2 = new StoryNode("He was interesting because he didn't have a colllar. That's pretty unusual around here.", container.UpdateImageAction(FIVE));

            sawAnotherCat.AddFreeTransition(sawAnotherCat1);
            sawAnotherCat1.AddFreeTransition(sawAnotherCat2);

            hobbiesWindow.AddInputBasedTransition("(see|saw|what was|look)".MatchSomewhere(), sawAnotherCat);

            StoryNode catLooksAwkward = new StoryNode(string.Format("<-- {0} looks very uncomfortable -->", catName), container.UpdateImageAction(TWO));

            sawAnotherCat2.AddFreeTransition(catLooksAwkward);

            catLooksAwkward.GraftStep(new StoryNode("Maybe I shouldn't have brought this up. I don't know why I did.", container.UpdateImageAction(6)));
            catLooksAwkward.GraftStep(new StoryNode("I feel odd talking about him.", container.UpdateImageAction(9)));

            StoryNode catKnowsHim = new StoryNode("Well... I knew him.", container.UpdateImageAction(NINE));

            catLooksAwkward.AddInputBasedTransition("(wrong?|okay?|uncomfortable|what's up?)".MatchSomewhere(), catKnowsHim);

            StoryNode hisNameWasRiddle = new StoryNode("He was a childhood friend. His name is Riddle.", container.UpdateImageAction(ELEVEN));

            catKnowsHim.AddInputBasedTransition("(name|who|how|from where|from when|how long|other cat|the cat|tell me)".MatchSomewhere(), hisNameWasRiddle);
            catKnowsHim.AddHint(new StoryNode(string.Format("{0} looks as though he's remembering something from long ago", catName), container.UpdateImageAction(ZERO)));
            catKnowsHim.AddHint(new StoryNode(string.Format("<--{0} looks as though he wants to talk about the other cat-->", catName)));
            catKnowsHim.AddHint(new StoryNode(string.Format("<--{0} just needs an excuse to explain how he knows the other cat-->", catName)));


            //leaf for the window branch
            StoryNode catWantsToStopTalkingAboutRiddle = new StoryNode("Let's discuss something else.", () =>
            {
                //can't talk about window anymore, finished with that branch.
                catHobbies.text = "My other hobbies are eating and sleeping.";
                catHobbies.RemoveInputBasedTransition("window");
                //go back to hobbies
                container.View.SetStory(catHobbies);

                //update the text after a time
                Timer timer    = TimerFactory.Instance.NewTimer();
                timer.onTimeUp = () => {
                    container.View.DisplayTextOfCurrentStoryNode();
                    container.View.UpdateImage(catImages[ZERO]);
                };
                timer.secondsDuration = 3f;
                timer.Begin();

                //add a new branch, from any other.
                root.AddInputBasedTransition("riddle".MatchSomewhere(), riddle);


                //player completed this branch, so give the player an item...
                MyEvents.PlayerGivenItem.Fire(new Item(string.Format("{0} knew a cat called Riddle", catName), string.Format("{0} seemed uncomfortable thinking about Riddle", catName)));
            });

            hisNameWasRiddle.AddFreeTransition(catWantsToStopTalkingAboutRiddle);
        }