public void RecordFoodToGlobalState() { DinnerPartyGlobals partyGlobals = FindObjectOfType <DinnerPartyGlobals>(); var foodArrangement = new _2020Vision.FoodArrangement { food = new List <_2020Vision.Food>() }; var contributionArrangement = new _2020Vision.ContributionArrangement { contributions = new List <_2020Vision.Contribution>() }; var choices = GetComponentsInChildren <FoodChoice>(); foreach (var foodChoice in choices) { foodChoice.CreateContribution(); foodArrangement.food.Add(foodChoice.food); contributionArrangement.contributions.Add(foodChoice.contribution); } partyGlobals.currentPartyState.foodArrangement = foodArrangement; partyGlobals.currentPartyState.contributionArrangement = contributionArrangement; }
// Start is called before the first frame update void Start() { DinnerPartyGlobals globals = GameObject.FindObjectOfType <DinnerPartyGlobals>(); for (int i = 0; i < 6; i++) { GameObject guestGameObject = transform.GetChild(i).gameObject; guestGameObject.GetComponentInChildren <Guest>().Setup(globals.Guests[i]); guestGameObject.GetComponentInChildren <TextMeshProUGUI>().SetText(globals.Guests[i].name); } }
public void Start() { DinnerPartyGlobals dinnerPartyGlobals = FindObjectOfType <DinnerPartyGlobals>(); string[] guestNames = new string[dinnerPartyGlobals.Guests.Count]; for (int i = 0; i < dinnerPartyGlobals.Guests.Count; i++) { guestNames[i] = dinnerPartyGlobals.Guests[i].name; } Regex setRegex = new Regex(SetRegex); Regex convoRegex = new Regex(ConversationRegex); for (int relativeIndex = 0; relativeIndex < textAssets.Length; relativeIndex++) { string inputText = textAssets[relativeIndex].text; TextConversation inputConversation = new TextConversation(); MatchCollection setMatches = setRegex.Matches(inputText); for (int i = 0; i < setMatches.Count; i++) { MatchCollection convoMatches = convoRegex.Matches(setMatches[i].Groups["Content"].Value); List <string[]> conversation = new List <string[]>(); for (int j = 0; j < convoMatches.Count; j++) { string relative = convoMatches[j].Groups["Relative"].Value; string text = convoMatches[j].Groups["Text"].Value; text = ReplaceRelativeNames(text, guestNames); //if (relativeIndex == 5) //{ // text = text.Replace("[allergy]", ); //} conversation.Add(new string[] { relative, text }); } switch (setMatches[i].Groups["Category"].Value) { case "History": inputConversation.texts[(int)TextType.History] = conversation; break; case "Seating": inputConversation.texts[(int)TextType.SeatingReq] = conversation; break; case "Food": inputConversation.texts[(int)TextType.FoodReq] = conversation; break; case "Bringing": inputConversation.texts[(int)TextType.Bringing] = conversation; break; } } inputConversation.relative = FindObjectOfType <DinnerPartyGlobals>().Persons[relativeIndex].name; textConversations[relativeIndex] = inputConversation; } //Display Granny texts DisplayReceivedTexts(0); }