public IEnumerator Typing(TextOption opt) { GameObject node1 = Instantiate(incomimng, parent.transform); PhoneTextMaker maker1 = node1.GetComponent <PhoneTextMaker>(); RectTransform rect1 = node1.GetComponent <RectTransform>(); maker1.CalculateSpaceNeeded(". . ."); rect1.localPosition = new Vector3(rect1.localPosition.x, -totalHeight - (maker1.heightDetermined * 0.5f), rect1.localPosition.z); totalHeight += maker1.heightDetermined + heightBuffer; yield return(new WaitForSeconds(1.5f)); totalHeight -= maker1.heightDetermined + heightBuffer; Destroy(node1); GameObject node2 = Instantiate(incomimng, parent.transform); PhoneTextMaker maker2 = node2.GetComponent <PhoneTextMaker>(); RectTransform rect2 = node2.GetComponent <RectTransform>(); TextDialogueManager t = GameObject.Find("SceneManager").GetComponent <TextDialogueManager>(); maker2.CalculateSpaceNeeded(t.nodes[opt.nodeID].text); rect2.localPosition = new Vector3(rect2.localPosition.x, -totalHeight - (maker2.heightDetermined * 0.5f), rect2.localPosition.z); totalHeight += maker2.heightDetermined + heightBuffer; MakeThoughts(t.nodes[opt.nodeID].options); }
public void AddMessage(string t) { GameObject node1 = Instantiate(outgoing, parent.transform); PhoneTextMaker maker1 = node1.GetComponent <PhoneTextMaker>(); RectTransform rect1 = node1.GetComponent <RectTransform>(); maker1.CalculateSpaceNeeded(t); rect1.localPosition = new Vector3(rect1.localPosition.x, -totalHeight - (maker1.heightDetermined * 0.5f), rect1.localPosition.z); totalHeight += maker1.heightDetermined + heightBuffer; }
// Use this for initialization void Start() { // save the top top = parent.transform.position.y; /* * // make 10 messages * for(int i = 0; i < 5; i++) * { * // spawn a blue message * GameObject message1 = Instantiate(outgoing, parent.transform); * PhoneTextMaker maker1 = message1.GetComponent<PhoneTextMaker>(); * RectTransform rect1 = message1.GetComponent<RectTransform>(); * * // set the vertical position of the message * rect1.localPosition = new Vector3(rect1.localPosition.x, -totalHeight, rect1.localPosition.z); * * // add this message's height to totalHeight * totalHeight += maker1.heightDetermined + heightBuffer; * * // spawn a grey message * GameObject message2 = Instantiate(incomimng, parent.transform); * PhoneTextMaker maker2 = message2.GetComponent<PhoneTextMaker>(); * RectTransform rect2 = message2.GetComponent<RectTransform>(); * * // set the vertical position of the message * rect2.localPosition = new Vector3(rect2.localPosition.x, -totalHeight, rect2.localPosition.z); * * // add this message's height to totalHeight * totalHeight += maker2.heightDetermined + heightBuffer; * }*/ GameObject node1 = Instantiate(incomimng, parent.transform); PhoneTextMaker maker1 = node1.GetComponent <PhoneTextMaker>(); RectTransform rect1 = node1.GetComponent <RectTransform>(); TextDialogueManager t = GameObject.Find("SceneManager").GetComponent <TextDialogueManager>(); maker1.CalculateSpaceNeeded(t.nodes[0].text); rect1.localPosition = new Vector3(rect1.localPosition.x, -totalHeight - (maker1.heightDetermined * 0.5f), rect1.localPosition.z); totalHeight += maker1.heightDetermined + heightBuffer; }