private void Appear() { gameObject.transform.localScale = HelperFuctions.ScaleVector(gameObject.transform.localScale, Time.deltaTime / minScale / scaleTime); if (gameObject.transform.localScale.x >= nativeScale.x) { gameObject.transform.localScale = nativeScale; state = bubbleState.there; thereStartTime = Time.time; } }
protected override string[] ParseAttributes(string attributeString) { string[] decisionParts = base.ParseAttributes(attributeString); if (decisionParts.Length < 1) { Debug.LogError("Statement initialized with " + decisionParts.Length.ToString() + " addional arguments, but expected at least 1!"); } attributes.Add(SpeechAttribute.LinksToID, decisionParts[0]); string[] unusedParts = HelperFuctions.SliceArray <string>(decisionParts, 1, -1); return(unusedParts); }
protected override string[] ParseAttributes(string attributeString) { string[] decisionParts = base.ParseAttributes(attributeString); if (decisionParts.Length < 2) { Debug.LogError("Speech initialized with " + decisionParts.Length.ToString() + ", but expected at least 2!"); } attributes.Add(SpeechAttribute.OnYes, decisionParts[0]); attributes.Add(SpeechAttribute.OnNo, decisionParts[1]); string[] unusedParts = HelperFuctions.SliceArray <string>(decisionParts, 2, -1); return(unusedParts); }
private void Disappear() { gameObject.transform.localScale = HelperFuctions.ScaleVector(gameObject.transform.localScale, 1 / (Time.deltaTime / minScale / scaleTime)); if (gameObject.transform.localScale.x <= nativeScale.x * minScale) { gameObject.transform.localScale = HelperFuctions.ScaleVector(nativeScale, minScale); state = bubbleState.idle; gameObject.SetActive(false); if (nextTextQueued) { Show(nextText); nextTextQueued = false; } } }
protected virtual string[] ParseAttributes(string attributeString) { string[] parts = attributeString.Split('^'); if (parts.Length < 3) { Debug.LogError("Speech initialized with " + parts.Length.ToString() + ", but expected at least 3!"); } // parts[0] is the S or D to differentiate between Statement and Decision attributes.Add(SpeechAttribute.ID, parts[1]); attributes.Add(SpeechAttribute.BubbleText, parts[2]); string[] unusedParts = HelperFuctions.SliceArray <string>(parts, 3, -1); return(unusedParts); }
private void ParseAttributes(string requestString) { string[] parts = requestString.Split('|'); if (parts.Length < 4) { Debug.LogError("Speech initialized with " + parts.Length.ToString() + ", but expected at least 4!"); } attributes.Add(RequestAttribute.ID, parts[0]); attributes.Add(RequestAttribute.Character, parts[1]); try { int.Parse(parts[2]); attributes.Add(RequestAttribute.SelectionChance, parts[2]); } catch { Debug.LogError("SelectionChance of request " + attributes[RequestAttribute.ID] + " is non-Integer. Using 0."); attributes.Add(RequestAttribute.SelectionChance, "0"); } foreach (string speechString in HelperFuctions.SliceArray <string>(parts, 3, -1)) { switch (speechString[0]) { case 'S': Statement s = new Statement(speechBubble); s.Initialize(speechString); speechList.Add(s.attributes[SpeechAttribute.ID], s); break; case 'D': Decision d = new Decision(speechBubble); d.Initialize(speechString); speechList.Add(d.attributes[SpeechAttribute.ID], d); break; default: Debug.LogError("Speech in Request " + attributes[RequestAttribute.ID] + " has invalid ID"); break; } } }
public string Execute() { string nextSpeechID = string.Empty; foreach (string command in commands) { string[] commandStructure = command.Split(':'); string c = commandStructure[0]; string[] a = HelperFuctions.SliceArray <string>(commandStructure, 1, -1); switch (c) { case "Energy": AddEnergy(a); break; case "Money": AddMoney(a); break; case "GroupHappiness": ChangeGroupHappiness(a); break; case "IndividualHappiness": ChangeHappiness(a); break; case "GroupRequest": break; case "IndividualRequest": break; case "GroupForce": break; case "IndividualForce": break; case "AddCrew": break; case "RemoveCrew": break; case "Next": nextSpeechID = ParseNextDecision(a); break; case "Other": break; default: Debug.LogError("Unknown command: " + c); break; } } return(nextSpeechID); }