void Rpc_spawnChatBubble(TEXT_MESSAGES messageType) { for (int i = 0; i < messagesPanel.transform.childCount; i++) { StartCoroutine(moveBubble(messagesPanel.transform.GetChild(i).gameObject)); } //SoundManager.instance.playSound(SoundManager.SOUNDS.NEW_MESSAGE); GameObject messageGo = Instantiate(messagePrefab, messagesPanel.transform); messageGo.transform.GetChild(0).GetComponent <Text>().text = messageDictionary[messageType]; messageGo.GetComponent <Image>().color = GetComponent <PropBlockNetworkColorSetter>().getColor(); if (!hasAuthority) { messageGo.GetComponent <RectTransform>().pivot = new Vector2(0, 0.5f); messageGo.GetComponent <RectTransform>().anchorMax = messageGo.GetComponent <RectTransform>().pivot; messageGo.GetComponent <RectTransform>().anchorMin = messageGo.GetComponent <RectTransform>().pivot; messageGo.GetComponent <Image>().sprite = flippedBubbleImage; StartCoroutine(scaleBubble(messageGo)); } Vector3 newPos = new Vector3(0, -190); messageGo.GetComponent <RectTransform>().anchoredPosition = newPos; StartCoroutine(scaleBubble(messageGo)); StartCoroutine(destroyBubbleOverTime(messageGo)); }
void Cmd_sendTextMessage(TEXT_MESSAGES messageType) { Rpc_spawnChatBubble(messageType); }