//Get the entire string we want to display public string FullEnd() { string RET_STRING = NAME.GetPlayerName() + "'s Evaluation:\n"; //Handle Family story if (EM.STORY_ENDING[0]) //Good ending { RET_STRING += "Mom was always the happiest person in the family. She might not have agreed with every way I lived my life, but she always loved me... I see that now. She always wanted me to be a mother... Maybe I'll adopt.\n\n"; } else //Bad ending { RET_STRING += "Mom was the one to ruin our relationship. She said so many despicable things about Mary, and while I'm not with Mary anymore, it's crazy how backwards she was. I'm a bit sad she's gone, but it's not like she was a big part of my life anyways... I miss her...\n\n"; } //Handle Date story if (EM.STORY_ENDING[1]) { RET_STRING += "Turns out, it's hard to really know a person in the beginning. Mike ended up being really creepy, messaging me all the time and trying to go on dates. His rude and inconsiderate behaviour was unacceptable and I am glad to have cut him out of my life.\n\n"; } else { RET_STRING += "Mike just wouldn't stop messaging me this whole month. He's been saying the most offensive, insensitive drivel I've heard in years; he's almost just as bad as my boss. I should have stopped messaging him earlier on. His actions have gone too far. Hopefully he'll lose interest after a while...\n\n"; } //Handle Job story if (EM.STORY_ENDING[2]) { RET_STRING += "My boss was just... too much. He pushed himself onto me despite all my refusal, and while I finally managed to push him away it seems he got me fired at work. There really wasn't anyway it was going to end well. At least I might find a job with a better boss!\n\n"; } else { RET_STRING += "What am I going to do? My boss is just pushing me around and doing whatever he wants around me. HR won't help, and no one believes me. But if I leave, he said things could get much worse...\n\n"; } //Handle happiness //Worst ending if (EM.HAPPINESS < BAD_ENDING_THRESHOLD) { RET_STRING += "I think this bot did more harm than good. My life has gotten so much worse. I'm not sure if I missed some important emails but the way life has been going its like a storm."; }//Bad ending else if (EM.HAPPINESS < GOOD_ENDING_THRESHOLD) { RET_STRING += "The AIDE System did a bit of work. I noticed a bit less ads but it still seems like I get scary messages once in a while. I'll keep this software a while longer."; }//Good ending else { RET_STRING += "AIDE System has been doing good work! My emails were mostly good, or at the very least, relevant to my life. I love this software."; } return(RET_STRING); }
// Update is called once per frame void Update() { switch (currentTypingState) { case TypingState.Idle: //if it needs to be idle break; case TypingState.Setup: //setup the line that needs to be displayed //call whatever function that will give us the right line to be displayed //call to get the stop index //call to get the delete index float HAPPINESS = GameObject.Find("GameManager").GetComponent <EmailManager>().HAPPINESS; int WEEK = GameObject.Find("GameManager").GetComponent <EmailManager>().WEEK; if (WEEK != 0) { currentLine = WeeklyMessages[WEEK]; if (HAPPINESS <= BadThreshold[WEEK]) { currentLine += WeeklyHappinessMessages[WEEK]; } else if (HAPPINESS >= GoodThreshold[WEEK]) { currentLine += WeeklyHappinessMessages[WEEK + 1]; } else { currentLine += WeeklyHappinessMessages[WEEK + 2]; } currentLine = currentLine.Replace("NAME", NAME.GetPlayerName()); } else { currentLine = "Hey there NAME. Let's get to work ok? I need you to make sure I receive emails from work and my family. If you think some are important, tag them as such. Anything you think is not relevant to me, you can just delete. \n Oky Thanks :)"; currentLine = currentLine.Replace("NAME", NAME.GetPlayerName()); } waitTime = 0.03f; setCurrentState(TypingState.Typing); //move on to typing break; case TypingState.Typing: //when the text needs to be displayed letter by letter if (currentLetterIndex < currentLine.Length && currentLetterIndex != stopIndex && getStateElapsed() > waitTime) { UI_Text.text += currentLine[currentLetterIndex]; currentLetterIndex += 1; waitTime += 0.03f; } else if (stopIndex != -1 && currentLetterIndex == stopIndex) { waitTime = 0.03f; setCurrentState(TypingState.Stop); } break; case TypingState.Reset: //Once dialogue is no longer displayed and needs to be reset currentLetterIndex = 0; //set letter index to 0 currentLine = ""; //reset the current line being displayed if (UI_Text != null) { UI_Text.text = ""; } setCurrentState(TypingState.Idle); break; case TypingState.Stop: //if there needs to be a pause in the display of the text if (getStateElapsed() > 1f) { setCurrentState(TypingState.Delete); } break; case TypingState.Delete: //if there needs a part of the current text to be deleted and replaced if (currentDeleteCount != deleteIndex) { UI_Text.text = UI_Text.text.Substring(0, UI_Text.text.Length - 1); currentDeleteCount += 1; } else { currentDeleteCount = 0; UI_Text.text += currentLine[currentLetterIndex]; currentLetterIndex += 1; setCurrentState(TypingState.Typing); } break; } }