public void InitEatingHobby() { StoryNode eating1 = new StoryNode("There's a lot of variation among the different food brands.", container.UpdateImageAction(FOUR)); StoryNode eating2 = new StoryNode("There's of course different flavors of cat food, like chicken, fish, beef; then within the flavor types there's wet and dry variants."); StoryNode eating3 = new StoryNode("I'm no mathematician, but there's a lot of combinations of cat food."); hobbiesEating.GraftStep(eating1); eating1.GraftStep(eating2); eating2.GraftStep(eating3); StoryNode favoriteFoods = new StoryNode("It depends... if it's wet food, probably Friskies chicken. " + "If it's dry food- uh, well. I kind of hate dry food.", container.UpdateImageAction(TEN)); hobbiesEating.AddHint(new StoryNode("Are you curious about my preferences?")); hobbiesEating.AddInputBasedTransition("(prefer|favorite|like|love|best)".MatchSomewhere(), favoriteFoods); }
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.")); }
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); }