protected override EventResult OnStage(EventStage currentStage) { switch (currentStage) { case EventStage.START: EventState.currentEventImage = "facePlayerSad"; EventState.currentEventText = "It’s been a month since your father died and passed the family potions shop on to you."; EventState.currentEventOptions = EventState.CONTINUE_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S1 }; return(EventResult.CONTINUE); case EventStage.S1: EventState.currentEventImage = "facePlayerNeutral"; EventState.currentEventText = "Passed on for generations, it offers potions made from peacock feathers."; EventState.currentEventOptions = EventState.CONTINUE_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S2 }; return(EventResult.CONTINUE); case EventStage.S2: EventState.currentEventImage = "facePlayerHappy"; EventState.currentEventText = "Now it's your turn to keep the business alive."; EventState.currentEventOptions = EventState.CONTINUE_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S3 }; return(EventResult.CONTINUE); case EventStage.S3: EventState.currentEventImage = ""; EventState.currentEventText = "Spring starts, and customers come and go, buying the potions your father made before he passed."; EventState.currentEventOptions = EventState.CONTINUE_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S4 }; EventState.PushEvent(new ExplainSalesEvent(), 0, 0, GameStage.GS_OVERLAY_POTION_SALES); return(EventResult.DONE); } return(EventResult.DONE); }
protected override EventResult OnStage(EventStage currentStage) { switch (currentStage) { case EventStage.START: EventState.currentEventText = "Your landlord enters the shop and comes up to you."; EventState.currentEventOptions = EventState.CONTINUE_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S1 }; return(EventResult.CONTINUE); case EventStage.S1: EventState.currentEventText = "\"Looks like you can't pay rent this season.\""; mCurrentOptionOutcomes = new EventStage[] { EventStage.ACCEPT }; return(EventResult.CONTINUE); case EventStage.ACCEPT: EventState.currentEventText = "\"I'll give you one more chance. Don't worry about this season's rent, but if you miss next season, I'll have to evict you.\""; // TODO: shorten, probably! EventState.currentEventOptions = EventState.OK_OPTION; EventState.PushEvent(new RestoreRentEvent(GameData.singleton.rent), GameData.singleton.quarter + 1, 0); GameData.singleton.rent = 0; // forgive the rent for one season return(EventResult.DONE); } return(EventResult.DONE); }
protected override EventResult OnStage(EventStage currentStage) { switch (currentStage) { case EventStage.START: EventState.currentEventImage = "facePlayerNeutral"; EventState.currentEventText = "You take stock of your potions. What did Dad say about this..?"; EventState.currentEventOptions = EventState.CONTINUE_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S1 }; return(EventResult.CONTINUE); case EventStage.S1: EventState.currentEventImage = "faceGrandfather"; EventState.currentEventText = "\"Make new potions out of feathers! Personally, I try to replace the potions I sold last season.\""; EventState.currentEventOptions = EventState.CONTINUE_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S2 }; return(EventResult.CONTINUE); case EventStage.S2: EventState.currentEventText = "\"You can change the prices too. If you didn't sell much of a potion, try making it cheaper.\""; EventState.currentEventOptions = EventState.OK_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S3 }; return(EventResult.CONTINUE); case EventStage.S3: EventState.currentEventText = "\"Some potions just aren't as popular as others... and people's tastes can change, too. It's important to adapt!\""; EventState.currentEventOptions = EventState.OK_OPTION; EventState.PushEvent(new ExplainPeacockEvent(), 0, 0, GameStage.GS_PEACOCK); return(EventResult.DONE); } return(EventResult.DONE); }
protected override EventResult OnStage(EventStage currentStage) { switch (currentStage) { case EventStage.START: case EventStage.S1: EventState.currentEventImage = "faceWifeHappy"; EventState.currentEventText = "10 years have passed.\nYou and " + NAME + " ended up getting married!"; EventState.currentEventOptions = EventState.CONTINUE_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S2 }; break; case EventStage.S2: EventState.currentEventImage = "faceSonHappy"; EventState.currentEventText = "You also had a son together!\nHe's growing up quickly."; EventState.currentEventOptions = EventState.CONTINUE_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S3 }; break; case EventStage.S3: EventState.currentEventImage = ""; EventState.currentEventText = "You've been running the potion shop together with " + NAME + ", and it's still doing about as well as it was 10 years ago."; EventState.currentEventOptions = EventState.OK_OPTION; // Time skip GameData.singleton.yearsSkipped = 10; GameData.singleton.wifeMarried = true; GameData.singleton.sonWasBorn = true; // Start queueing events for the son SonEventChain.Init(); // The son event will likely happen next, so delay the next wife event a bit longer EventState.PushEvent(new WifeEventFive(), GameData.singleton.quarter + 2, 0f); return(EventResult.DONE); } return(EventResult.CONTINUE); }
protected override EventResult OnStage(EventStage currentStage) { switch (currentStage) { case EventStage.START: EventState.currentEventText = string.Format("A woman approaches the counter. \"Do you have any {0} potions?\"", mPotionType.GetName().ToLower()); EventState.currentEventOptions = new string[] { "We've run out, but you should try again next season.", "We've run out, and I don't know when we'll have more." }; mCurrentOptionOutcomes = new EventStage[] { EventStage.ACCEPT, EventStage.REFUSE }; return(EventResult.CONTINUE); case EventStage.ACCEPT: EventState.currentEventText = "\"Oh okay, I'll try again next season. Thanks!\" the woman says as she leaves."; EventState.currentEventOptions = EventState.OK_OPTION; EventState.PushEvent(new OutOfStockReturnEvent(mPotionType), GameData.singleton.quarter + 1, 0.6f); return(EventResult.DONE); case EventStage.REFUSE: EventState.currentEventText = "\"Oh okay. I'll have to look elsewhere,\" she says. She takes her leave."; EventState.currentEventOptions = EventState.OK_OPTION; GameData.singleton.storePopularity *= 0.95f; GameData.singleton.outOfStockEventCooldown = GameData.singleton.quarter + 2; return(EventResult.DONE); } return(EventResult.CONTINUE); }
public static void Load(List <ScheduledEvent.ScheduledEventSaveData> saveData) { Debug.Log("loading event data"); foreach (ScheduledEvent.ScheduledEventSaveData data in saveData) { Debug.Log("data is of type " + data.GetType()); Debug.Log("event is type " + data.eventType); if (data.specificData != null) { ConstructorInfo constructor = data.eventType.GetConstructor(new Type[] { data.specificData.GetType() }); if (constructor != null) { GameEvent e = (GameEvent)constructor.Invoke(new object[] { data.specificData }); EventState.PushEvent(e, data.quarter, data.minDelay, data.gameStage); } else { Debug.LogError("failed to find constructor for event of type " + data.eventType + " with param " + data.specificData.GetType()); } } else { ConstructorInfo constructor = data.eventType.GetConstructor(Type.EmptyTypes); if (constructor != null) { GameEvent e = (GameEvent)constructor.Invoke(null); EventState.PushEvent(e, data.quarter, data.minDelay, data.gameStage); } else { Debug.LogError("failed to find default constructor for event of type " + data.eventType); } } } }
protected override EventResult OnStage(EventStage currentStage) { switch (currentStage) { case EventStage.START: EventState.currentEventImage = "faceWifeNeutral"; EventState.currentEventText = string.Format("{0} comes up to you. She suggests buying a special toy for your son's birthday.", WifeEventChain.NAME); if (GameData.singleton.money >= toyCost) { EventState.currentEventOptions = new string[] { "Give her " + Utilities.FormatMoney(toyCost), "Say you can't afford it" }; mCurrentOptionOutcomes = new EventStage[] { EventStage.ACCEPT, EventStage.REFUSE }; } else { EventState.currentEventOptions = new string[] { "Say you can't afford it" }; mCurrentOptionOutcomes = new EventStage[] { EventStage.REFUSE }; } break; case EventStage.ACCEPT: EventState.currentEventImage = "faceWifeHappy"; EventState.currentEventText = "\"I think this will make him very happy.\" She gives you a quick kiss and leaves the shop."; EventState.PushEvent(new SonEventBirthday(), GameData.singleton.quarter + 1); GameData.singleton.wifeRelationship += 5; BusinessState.MoneyChangeFromEvent(-toyCost); EventState.currentEventOptions = EventState.CONTINUE_OPTION; return(EventResult.DONE); case EventStage.REFUSE: EventState.currentEventImage = "faceWifeSad"; if (GameData.singleton.money <= toyCost * 5) { EventState.currentEventText = "\"That's too bad. I know things are tough right now. He'll understand.\""; } else if (GameData.singleton.money >= toyCost * 10) { EventState.currentEventText = "\"I think we could spare it. How can you neglect our son like that?\" She goes outside."; GameData.singleton.wifeRelationship -= 10; } else { EventState.currentEventText = "\"Okay, I'll see if I can find something else myself...\" She leaves."; } EventState.currentEventOptions = EventState.CONTINUE_OPTION; return(EventResult.DONE); } return(EventResult.CONTINUE); }
protected override EventResult EventStart() { if (GameData.singleton.money < COST) { Debug.Log("postponing investment event to next quarter"); EventState.PushEvent(new InvestmentEventStart(), GameData.singleton.quarter + 1); return(EventResult.SKIP); } return(EventResult.CONTINUE); }
private void InitNewGame() { GameData.EraseGame(); // initialize events here for the moment.. EventState.Clear(); EventState.PushEvent(new TutorialEventChain.IntroductionEvent(), 0, 0); WifeEventChain.Init(); InvestmentEventChain.Init(); FestivalEventChain.Init(); PoisonDemandChangeEventChain.Init(); GameData.singleton.money = DebugOverrides.StartingMoney; GameData.singleton.initialBalance = GameData.singleton.money; // Set final balance for the previous quarter so that next Q can use it as initial balance GameData.singleton.finalBalance = GameData.singleton.money; GameData.singleton.rent = 300; // Starting unlocks GameData.singleton.potionsUnlocked[(int)PotionType.PT_LOVE_POTION] = true; GameData.singleton.potionsUnlocked[(int)PotionType.PT_FIRE_POTION] = true; // Queue timed unlocks of other potion types // The game starts in quarter 0 EventState.PushEvent(new UnlockPotionEvent(PotionType.PT_POISON_POTION), 1); EventState.PushEvent(new UnlockPotionEvent(PotionType.PT_INVIS_POTION), 2); EventState.PushEvent(new UnlockPotionEvent(PotionType.PT_LUCK_POTION), 3); // Starting feathers owned GameData.singleton.feathersOwned[(int)FeatherType.FT_GREEN_FEATHER] = 0; GameData.singleton.feathersOwned[(int)FeatherType.FT_PINK_FEATHER] = 0; GameData.singleton.feathersOwned[(int)FeatherType.FT_ORANGE_FEATHER] = 5; GameData.singleton.feathersOwned[(int)FeatherType.FT_BLUE_FEATHER] = 5; for (int i = 0; i < (int)FeatherType.FT_MAX; i++) { GameData.singleton.feathersUnlocked[i] = GameData.singleton.feathersOwned[i] > 0; } // Starting potions owned and prices for (int i = 0; i < GameData.singleton.potionsOwned.Length; ++i) { GameData.singleton.potionsOwned[i] = GameData.singleton.potionsUnlocked[i] ? 10 : 0; int numFeathersInRecipe = 0; foreach (FeatherAndCount feathAndCount in ((PotionType)i).GetIngredients()) { numFeathersInRecipe += feathAndCount.count; } GameData.singleton.potionPrices[i] = 25 * numFeathersInRecipe; GameData.singleton.quarterlyReportSalePrices[i] = 25 * numFeathersInRecipe; } InitWorldParams(); }
protected override EventResult OnStage(EventStage currentStage) { switch (currentStage) { case EventStage.START: EventState.currentEventText = "Your son runs up to you while you're at the counter."; EventState.currentEventOptions = EventState.CONTINUE_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S1 }; break; case EventStage.S1: EventState.currentEventImage = "faceSonHappy"; EventState.currentEventText = "\"Daddy! What are you doing?\""; EventState.currentEventOptions = new string[] { "\"Making magical potions, dear.\"", "\"Adult stuff. Why don't you go play with mom?\"" }; mCurrentOptionOutcomes = new EventStage[] { EventStage.S2, EventStage.REFUSE }; break; case EventStage.S2: EventState.currentEventImage = "faceSonSurprise"; EventState.currentEventText = "Magical! Can you make one that makes me fly?!"; EventState.currentEventOptions = new string[] { "\"Why not try yourself?\"", "\"Maybe later. I'm busy right now.\"" }; mCurrentOptionOutcomes = new EventStage[] { EventStage.ACCEPT, EventStage.REFUSE }; break; case EventStage.ACCEPT: EventState.currentEventImage = ""; EventState.currentEventText = "Excited, he grabs some empty bottles and runs over to the cauldron."; EventState.currentEventOptions = EventState.OK_OPTION; GameData.singleton.sonRelationship += 10; EventState.PushEvent(new SonDropBottlesEvent(), GameData.singleton.quarter); return(EventResult.DONE); case EventStage.REFUSE: EventState.currentEventImage = "faceSonSad"; EventState.currentEventText = "\"Okayy.\" He walks upstairs, looking dejected."; EventState.currentEventOptions = EventState.OK_OPTION; GameData.singleton.sonRelationship -= 10; EventState.PushEvent(new SonEventTwo(), GameData.singleton.quarter + 2); return(EventResult.DONE); } return(EventResult.CONTINUE); }
public static void SellProduct(int product) { GameData.singleton.money += GameData.singleton.potionPrices[product]; GameData.singleton.potionsOwned[product] -= 1; GameData.singleton.quarterlySales[product] += 1; Debug.Log("Sold a " + (PotionType)product + "! money: " + GameData.singleton.money); // Hacky way to call code from another system GameObject.FindObjectsOfType <UIControllerSystem>()[0].ShowSale((PotionType)product); // Have a random chance to spawn an event // TODO: move event spawning into a new system if (Random.Range(0f, 1f) <= 0.01f && GameData.singleton.quarter > 4) { EventState.PushEvent(new ThiefEvent(), GameData.singleton.quarter); } }
protected override EventResult OnStage(EventStage currentStage) { switch (currentStage) { case EventStage.START: EventState.currentEventText = "You overhear a conversation between customers..."; EventState.currentEventOptions = EventState.CONTINUE_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S1 }; break; case EventStage.S1: EventState.currentEventText = string.Format("\"I can't wait for next year's summer festival!\""); EventState.currentEventOptions = EventState.CONTINUE_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S2 }; break; case EventStage.S2: EventState.currentEventText = string.Format("\"Yes! I love trying my luck at all the little games they set up.\""); EventState.currentEventOptions = EventState.CONTINUE_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S3 }; break; case EventStage.S3: EventState.currentEventText = string.Format("\"Not to mention the big lottery at the end.\""); EventState.currentEventOptions = EventState.CONTINUE_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S4 }; break; case EventStage.S4: EventState.currentEventText = string.Format("\"Fingers crossed for that!\""); EventState.currentEventOptions = EventState.CONTINUE_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S5 }; break; case EventStage.S5: EventState.currentEventText = string.Format("The customers return to their shopping."); EventState.currentEventOptions = EventState.OK_OPTION; GameData.singleton.productDemand[(int)PotionType.PT_LUCK_POTION] += 0.1f; // increase demand now, so that it takes effect in the spring EventState.PushEvent(new FestivalReminderEvent(), GameData.singleton.quarter + 1); return(EventResult.DONE); } return(EventResult.CONTINUE); }
protected override EventResult OnStage(EventStage currentStage) { switch (currentStage) { case EventStage.START: EventState.currentEventImage = "faceWifeHappy"; if (GameData.singleton.wifeUsedLovePotion) { EventState.currentEventText = "Despite being under the influence of a love potion for the first date, you and " + NAME + " ended up going on many more dates and growing quite close."; } else { EventState.currentEventText = "You and " + NAME + " ended up going on many dates and growing quite close."; } EventState.currentEventOptions = EventState.OK_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S1 }; break; case EventStage.S1: EventState.currentEventImage = "faceWifeHappy"; EventState.currentEventText = "\"Hi again! Did you know that Ancadian Peacocks will grow more feathers of a given color depending on the season?\""; EventState.currentEventOptions = new string[] { "Neat!", "Oh yea, I noticed that" }; mCurrentOptionOutcomes = new EventStage[] { EventStage.S2, EventStage.S2 }; break; case EventStage.S2: EventState.currentEventImage = "faceWifeNeutral"; EventState.currentEventText = "\"It's a remarkable bird. There are other factors that affect the color of their feathers too, but I haven't figured it all out yet.\""; EventState.currentEventOptions = EventState.CONTINUE_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S3 }; break; case EventStage.S3: EventState.currentEventImage = "faceWifeHappy"; EventState.currentEventText = "\"Anyways, enough about the bird. I'm looking forward to seeing you tonight!\""; EventState.currentEventOptions = new string[] { "Me too!" }; // Queue an event for the start of the next quarter EventState.PushEvent(new WifeEventMarriage(), GameData.singleton.quarter + 1, 0f); return(EventResult.DONE); } return(EventResult.CONTINUE); }
protected override EventResult OnStage(EventStage currentStage) { switch (currentStage) { case EventStage.START: EventState.currentEventText = "The summer festival is next season!"; EventState.currentEventOptions = EventState.CONTINUE_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S5 }; break; case EventStage.S5: EventState.currentEventText = "Maybe I should go."; EventState.currentEventOptions = EventState.OK_OPTION; GameData.singleton.productDemand[(int)PotionType.PT_LUCK_POTION] += 0.2f; // increase demand even more for the festival itself EventState.PushEvent(new FestivalOverEvent(), GameData.singleton.quarter + 2); return(EventResult.DONE); } return(EventResult.CONTINUE); }
protected override EventResult OnStage(EventStage currentStage) { switch (currentStage) { case EventStage.START: EventState.currentEventText = "You hear a crash from across the store. You glance over and see that your son knocked over some potions."; EventState.currentEventOptions = EventState.CONTINUE_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S1 }; break; case EventStage.S1: EventState.currentEventImage = "faceSonSad"; EventState.currentEventText = "\"Waaah! I- I didn't mean to!\""; EventState.currentEventOptions = EventState.CONTINUE_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S2 }; EventState.currentEventOptions = new string[] { "Console him and clean up the mess", "Tell him to go upstairs" }; mCurrentOptionOutcomes = new EventStage[] { EventStage.GO_CLEAN, EventStage.GO_OUTSIDE }; break; case EventStage.GO_CLEAN: EventState.currentEventImage = "faceSonNeutral"; EventState.currentEventText = "He fetches a broom and helps you clean up. Then he decides to go outside."; EventState.currentEventOptions = EventState.OK_OPTION; EventState.PushEvent(new SonEventTwo(), GameData.singleton.quarter + 2); // schedule another event for next quarter GameData.singleton.sonRelationship += 5; return(EventResult.DONE); case EventStage.GO_OUTSIDE: EventState.currentEventImage = "faceSonSad"; EventState.currentEventText = "He sniffles and heads upstairs."; EventState.currentEventOptions = EventState.OK_OPTION; EventState.PushEvent(new SonEventTwo(), GameData.singleton.quarter + 2); // schedule another event for next quarter GameData.singleton.sonRelationship -= 5; return(EventResult.DONE); } return(EventResult.CONTINUE); }
protected override EventResult OnStage(EventStage currentStage) { switch (currentStage) { case EventStage.START: EventState.currentEventImage = "faceOther"; EventState.currentEventText = "Someone approaches you at the counter. \"I have a proposition for you.\""; EventState.currentEventOptions = new string[] { "Go on..." }; mCurrentOptionOutcomes = new EventStage[] { EventStage.DECIDE }; break; case EventStage.DECIDE: EventState.currentEventImage = "faceOther"; EventState.currentEventText = string.Format("I've got an investment opportunity. Lend me {0}, and I'll pay you back double.", Utilities.FormatMoney(COST)); EventState.currentEventOptions = new string[] { "Accept the deal", "Refuse" }; mCurrentOptionOutcomes = new EventStage[] { EventStage.ACCEPT, EventStage.REFUSE }; break; case EventStage.ACCEPT: EventState.currentEventImage = "faceOther"; EventState.currentEventText = string.Format("\"You won't regret this!\", he says. He takes your {0} and leaves.", Utilities.FormatMoney(COST)); EventState.PushEvent(new InvestmentReturnEvent(), GameData.singleton.quarter + 4); BusinessState.MoneyChangeFromEvent(-COST); EventState.currentEventOptions = EventState.OK_OPTION; return(EventResult.DONE); case EventStage.REFUSE: EventState.currentEventImage = "faceOther"; EventState.currentEventText = "\"Suit yourself...\", he says. He leaves without another word."; EventState.currentEventOptions = EventState.OK_OPTION; return(EventResult.DONE); } return(EventResult.CONTINUE); }
protected override EventResult OnStage(EventStage currentStage) { switch (currentStage) { case EventStage.START: EventState.currentEventText = "You overhear a conversation between customers..."; EventState.currentEventOptions = EventState.CONTINUE_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S1 }; break; case EventStage.S1: EventState.currentEventText = string.Format("\"Is it just me, or have there been more rats around lately?\""); EventState.currentEventOptions = EventState.CONTINUE_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S2 }; break; case EventStage.S2: EventState.currentEventText = string.Format("\"Yes! Just last week I found 3 of them in my basement!\""); EventState.currentEventOptions = EventState.CONTINUE_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S3 }; break; case EventStage.S3: EventState.currentEventText = string.Format("\"I hope they don't get too out of hand, the vermin.\""); EventState.currentEventOptions = EventState.CONTINUE_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S4 }; break; case EventStage.S4: EventState.currentEventText = string.Format("The customers return to their shopping."); EventState.currentEventOptions = EventState.OK_OPTION; GameData.singleton.productDemand[(int)PotionType.PT_POISON_POTION] += sDemandChange; EventState.PushEvent(new PoisonDemandDownEvent(), GameData.singleton.quarter + 3); return(EventResult.DONE); } return(EventResult.CONTINUE); }
protected override EventResult OnStage(EventStage currentStage) { switch (currentStage) { case EventStage.START: EventState.currentEventImage = "faceWifeHappy"; EventState.currentEventText = "\"Hi there! Is that an Ancadian Peacock?\""; EventState.currentEventOptions = new string[] { "Umm, yeah!", "I don’t actually know..." }; mCurrentOptionOutcomes = new EventStage[] { EventStage.S1, EventStage.S1 }; break; case EventStage.S1: EventState.currentEventImage = "faceWifeNeutral"; EventState.currentEventText = "\"It’s quite majestic. Oh, my name is " + NAME + " by the way.\""; EventState.currentEventOptions = new string[] { "It’s a fancy fantastical pheasant!", "Magestic? I suppose it is." }; mCurrentOptionOutcomes = new EventStage[] { EventStage.S2, EventStage.S2 }; break; case EventStage.S2: EventState.currentEventImage = "faceWifeNeutral"; EventState.currentEventText = "\"I've never seen one of this breed before. Do you mind if I study it for a little while?\""; EventState.currentEventOptions = new string[] { "Of course! It’s quite friendly." }; mCurrentOptionOutcomes = new EventStage[] { EventStage.S3 }; break; case EventStage.S3: EventState.currentEventImage = "faceWifeNeutral"; EventState.currentEventText = "She is staring intently at the peacock and seems to have forgotten about you for now."; EventState.currentEventOptions = EventState.OK_OPTION; EventState.PushEvent(new WifeEventTwo(), GameData.singleton.quarter + 1); // schedule another event for next quarter return(EventResult.DONE); } return(EventResult.CONTINUE); }
protected override EventResult OnStage(EventStage currentStage) { switch (currentStage) { case EventStage.START: EventState.currentEventImage = "faceWifeHappy"; EventState.currentEventText = "\"Hi!\""; EventState.currentEventOptions = new string[] { "..." }; mCurrentOptionOutcomes = new EventStage[] { EventStage.S1 }; break; case EventStage.S1: EventState.currentEventImage = "faceWifeNeutral"; EventState.currentEventText = "\"I noticed how hard you work so I brought you some tea, here!\""; EventState.currentEventOptions = new string[] { "Drink it" }; mCurrentOptionOutcomes = new EventStage[] { EventStage.S2 }; break; case EventStage.S2: GameData.singleton.wifeUsedLovePotion = true; EventState.currentEventImage = "facePlayerSurprise"; EventState.currentEventText = "Ah! It tastes sweeter than I expected!\nI like it though."; EventState.currentEventOptions = EventState.CONTINUE_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S3 }; break; case EventStage.S3: EventState.currentEventImage = "faceWifeHappy"; EventState.currentEventText = NAME + " winks at you, then heads out."; EventState.currentEventOptions = EventState.OK_OPTION; EventState.PushEvent(new WifeEventGrowClose(), GameData.singleton.quarter + 1); // schedule another event for next quarter return(EventResult.DONE); } return(EventResult.CONTINUE); }
public static void Init() { Debug.Log("pushing son event"); EventState.PushEvent(new WifeEventOne(), 1); }
protected override EventResult OnStage(EventStage currentStage) { switch (currentStage) { case EventStage.START: EventState.currentEventImage = "faceWifeHappy"; EventState.currentEventText = "\"Hello again!\""; EventState.currentEventOptions = new string[] { "Welcome back!" }; mCurrentOptionOutcomes = new EventStage[] { EventStage.S1 }; break; case EventStage.S1: EventState.currentEventImage = "faceWifeNeutral"; EventState.currentEventText = "\"Thanks for letting me observe your peacock last time. I was writing a paper on the species, and seeing it was really helpful.\""; EventState.currentEventOptions = EventState.CONTINUE_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S2 }; break; case EventStage.S2: EventState.currentEventImage = "faceWifeNeutral"; EventState.currentEventText = "\"Would you like to go out for tea after work?\""; EventState.currentEventOptions = new string[] { "Sure!", "No thanks, I'm too busy." }; mCurrentOptionOutcomes = new EventStage[] { EventStage.ACCEPT, EventStage.REFUSE }; break; case EventStage.ACCEPT: EventState.currentEventImage = "faceWifeHappy"; GameData.singleton.wifeRelationship += 10f; EventState.currentEventText = "\"Awesome, I know a great place!\"\n<i>She runs off in excitement</i>"; EventState.currentEventOptions = EventState.OK_OPTION; EventState.PushEvent(new WifeEventGrowClose(), GameData.singleton.quarter + 2); // schedule another event for next quarter return(EventResult.DONE); case EventStage.REFUSE: EventState.currentEventImage = "faceWifeSad"; EventState.currentEventText = "\"Aw, okay.\nOn an unrelated note, do you sell love potions?\""; if (GameData.singleton.potionsOwned[(int)PotionType.PT_LOVE_POTION] > 0) { EventState.currentEventOptions = new string[] { "Yes" }; mCurrentOptionOutcomes = new EventStage[] { EventStage.HAS_POTION }; } else { EventState.currentEventOptions = new string[] { "\"Yes, but we don't have any right now\"" }; mCurrentOptionOutcomes = new EventStage[] { EventStage.NO_POTION }; } break; case EventStage.HAS_POTION: EventState.currentEventImage = "faceWifeNeutral"; GameData.singleton.wifeRelationship += 1f; EventState.currentEventText = "\"I'll buy one love potion then!\"\n<i>She pays the price and heads out.</i>"; BusinessSystem.SellProduct((int)PotionType.PT_LOVE_POTION); EventState.currentEventOptions = EventState.OK_OPTION; EventState.PushEvent(new WifeEventLovePotion(), GameData.singleton.quarter + 1); // schedule another event for next quarter return(EventResult.DONE); case EventStage.NO_POTION: EventState.currentEventImage = "faceWifeNeutral"; EventState.currentEventText = "\"Alright. Well, I'll be around.\""; EventState.currentEventOptions = EventState.OK_OPTION; EventState.PushEvent(new WifeEventLovePotion(), GameData.singleton.quarter + 1); // schedule another event for next quarter return(EventResult.DONE); } return(EventResult.CONTINUE); }
protected override void EventEnd(int choice) { EventState.PushEvent(new ExplainBrewingEvent(), 0, 0, GameStage.GS_RESOURCE_ALLOCATION); GameObject.FindObjectsOfType <UIControllerSystem>()[0].RestoreNormalEventOverlayPosition(); }
protected override void EventEnd(int choice) { EventState.PushEvent(new ExplainExpensesEvent(), 0, 0, GameStage.GS_OVERLAY_FINANCIAL_SUMMARY); }
protected override void EventEnd(int choice) { EventState.PushEvent(new ExplainFeathersEvent(), 0, 0, GameStage.GS_OVERLAY_FEATHER_COLLECTION); }
// Update is called once per frame void Update() { if (EventState.currentEvent != null) { return; // no updating while an event is happening } if (GameData.singleton.currentStage == GameStage.GS_SIMULATION) { if (GameData.singleton.totalQuarterlyCustomers <= 0) // no more customers to handle { if (!EventState.hasMoreEventsRightNow && GameData.singleton.quarterTimeElapsed >= QuarterTotalTime) { // transition to "end of quarter" stage Debug.Log("All customers served this quarter."); GameStageExtensions.GameLoopGotoNextStage(); } } else { // yeah like it's slightly gross to do this here in this way... // running code on state changes really does want an event-driven style thing, I guess if (mPaymentTime == 0) { mPaymentTime = QuarterTotalTime / GameData.singleton.totalQuarterlyCustomers; mPaymentTimer = mPaymentTime; } mPaymentTimer -= Time.deltaTime; if (mPaymentTimer <= 0) { int product = Random.Range(0, (int)PotionType.PT_MAX); while (GameData.singleton.quarterlyCustomers[product] == 0) { product = (product + 1) % (int)PotionType.PT_MAX; } if (GameData.singleton.potionsOwned[product] > 0) { SellProduct(product); } else { GameData.singleton.unfulfilledDemand[product] += 1; Debug.Log("A customer wanted " + (PotionType)product + " but we were out of stock"); // get enough of this, and we queue up an event where a customer asks for this type specifically if (GameData.singleton.unfulfilledDemand[product] > 3 && GameData.singleton.outOfStockEventCooldown <= GameData.singleton.quarter) { EventState.PushEvent(new OutOfStockEvent((PotionType)product), GameData.singleton.quarter); GameData.singleton.outOfStockEventCooldown = GameData.singleton.quarter + 2; } } mPaymentTimer = Random.Range(mPaymentTime * 0.9f, mPaymentTime * 1.1f); GameData.singleton.quarterlyCustomers[product] -= 1; --GameData.singleton.totalQuarterlyCustomers; } } } else if (GameData.singleton.currentStage == GameStage.GS_END_OF_QUARTER) { if (GameData.singleton.money < GameData.singleton.rent && !GameData.singleton.missedRent) { if (GameData.singleton.lastMissedRentQuarter == -1) { EventState.PushEvent(new MissedRentEvents.MissedRentEvent(), GameData.singleton.quarter, 0, GameStage.GS_END_OF_QUARTER); // going to miss rent? add event GameData.singleton.lastMissedRentQuarter = GameData.singleton.quarter; } else if (GameData.singleton.lastMissedRentQuarter == GameData.singleton.quarter - 1) { EventState.PushEvent(new MissedRentEvents.MissedRentAgainEvent(), GameData.singleton.quarter, 0, GameStage.GS_END_OF_QUARTER); // game over GameData.singleton.missedRent = true; } else { Debug.LogError("Missed rent in quarter " + GameData.singleton.lastMissedRentQuarter + " but it's now " + GameData.singleton.quarter + ", and somehow it wasn't cleared?"); } } else if (GameData.singleton.lastMissedRentQuarter < GameData.singleton.quarter) { GameData.singleton.lastMissedRentQuarter = -1; } if (GameData.singleton.peacockHealth <= 0 && !GameData.singleton.peacockDied) { EventState.PushEvent(new PeacockSickEvent(), GameData.singleton.quarter, 0, GameStage.GS_END_OF_QUARTER); GameData.singleton.peacockDied = true; } if (GameData.singleton.quarter >= 16 && !GameData.singleton.reachedEndOfLife && !GameData.singleton.missedRent && !GameData.singleton.peacockDied) { EventState.PushEvent(new EndOfLifeEvent(), GameData.singleton.quarter, 0); GameData.singleton.reachedEndOfLife = true; } if (!EventState.hasMoreEventsRightNow) // ensure we play through all events before advancing to next quarter { mPaymentTime = 0; // Advance to the next quarter and update any other affected state // Go tho the end-of-quarter summary state (or game over state) if (GameData.singleton.reachedEndOfLife) { MainGameSystem.GameOver(); } else { // This will advance to the summaries after the end of the quarter GameStageExtensions.GameLoopGotoNextStage(); } Debug.Log("game stage is now " + GameData.singleton.currentStage); } } }
public static void Init() { EventState.PushEvent(new SonEventOne(), GameData.singleton.quarter + 1); }
public static void Init() { EventState.PushEvent(new PoisonDemandUpEvent(), 3); }
public static void Init() { EventState.PushEvent(new FestivalIntroEvent(), 7); // winter of 2nd year }
public static void Init() { EventState.PushEvent(new InvestmentEventStart(), 3); }