private void CreateFloatingText(string a_Message, Color a_Color, Vector3 a_Anchor) { FloatingText newObject = Instantiate(m_FloatingTextPrefab); newObject.transform.SetParent(UIManager.self.backgroundUI.transform, false); newObject.anchor = a_Anchor; Text newText = newObject.GetComponent <Text>(); newText.text = a_Message; newText.color = a_Color; StartCoroutine(Animations.Animate(m_FloatingTextSequence, newText)); StartCoroutine(WaitThenDoThis(m_FloatingTextSequence.totalAnimationTime, delegate { Destroy(newText.gameObject); })); }
public void Chat(string a_Nickname, string a_Message, Unit a_Unit, ChatType a_ChatType = ChatType.Say) { Text newLogItem = Instantiate(m_LogTextPrefab); newLogItem.transform.SetParent(UIManager.self.backgroundUI.transform, false); switch (a_ChatType) { case ChatType.Say: newLogItem.color = Color.black; newLogItem.text = a_Nickname + " says: " + a_Message; break; case ChatType.Yell: newLogItem.color = Color.red; newLogItem.text = a_Nickname + " yells: " + a_Message; break; } FloatingText newObject = Instantiate(m_FloatingTextPrefab); newObject.transform.SetParent(UIManager.self.backgroundUI.transform, false); newObject.anchor = new Vector3(0, 1f, 0); newObject.parent = a_Unit; Text newText = newObject.GetComponent <Text>(); newText.text = a_Message + "\n|"; newText.color = newLogItem.color; StartCoroutine(Animations.Animate(m_ChatSequence, newText)); StartCoroutine(WaitThenDoThis(m_ChatSequence.totalAnimationTime, delegate { Destroy(newText.gameObject); })); StartCoroutine(AnimateToLog(newLogItem)); }