Exemple #1
0
    // Displays text to screen
    public void DisplayText(string text, GameObject obj = null)
    {
        //actionTextBox.text += text + "\n";
        FloatingText ft = Instantiate(floatingText, battleCanvas.transform).GetComponentInChildren <FloatingText>();

        ft.Set(text);
        if (obj != null)
        {
            Debug.Log("<b>SPAWING TEXT POPUP AT " + obj.transform.position + "</b>");
            ft.transform.position = Camera.main.WorldToScreenPoint(obj.transform.position);
        }
        else
        {
            ft.transform.localPosition = new Vector3(0, 0);
        }

        Debug.Log(text);

        /*if (actionTextBox.text.Length > 800)
         * {
         *  actionTextBox.text = actionTextBox.text.Remove(0, 100);
         *  int temp1 = actionTextBox.text.IndexOf("<");
         *  int temp2 = actionTextBox.text.IndexOf("/");
         *  while (actionTextBox.text.Remove(14).Contains(">") || temp1 == temp2 - 1)
         *  {
         *      actionTextBox.text = actionTextBox.text.Remove(0, 1);
         *      temp1 = actionTextBox.text.IndexOf("<");
         *      temp2 = actionTextBox.text.IndexOf("/");
         *  }
         * }*/
    }
Exemple #2
0
    public void CreatFloatingText(string text, Transform transform, int type)
    {
        FloatingText instance = null;

        switch (type)
        {
        case 0:
            instance = popupText_Player;
            break;

        case 1:
            instance = popupText_Enemy;
            break;
        }

        FloatingText floatingText = Instantiate(instance);

        floatingText.transform.SetParent(canvas, false);
        floatingText.Set(text, transform);
    }