Ejemplo n.º 1
0
    public void ShowMessage(int senderTurn, string messageId)
    {
        var senderPlace = PlayerBase.ConvertTurnToPlace(senderTurn, RoomSettings.I.MyTurn);

        GameObject obj;

        if (texts.ContainsKey(messageId))
        {
            obj = Instantiate(textMessageViewPrefab, transform);
            obj.transform.GetChild(0).GetComponent <RTLTextMeshPro>().text = texts[messageId];
        }
        else
        {
            obj = Instantiate(emojiMessageViewPrefab, transform);
            obj.transform.GetChild(0).GetComponent <Image>().sprite = emojis[messageId];
        }


        obj.transform.position   = messagesStartTransform[senderPlace].position;
        obj.transform.rotation   = messagesStartTransform[senderPlace].rotation;
        obj.transform.localScale = messagesStartTransform[senderPlace].localScale;

        obj.transform.DOScale(1, .3f);
        obj.transform.DOMove(messagesEndTransform[senderPlace].position, .4f);

        Destroy(obj, 2);
    }