public static void CreateDamagePopUp(string text, Vector2 location, bool IsCrit, DamageType damageType)
    {
        PopUpText instance = Instantiate(popUpText);

        instance.transform.SetParent(canvas.transform, false);

        Vector2 position = new Vector2(Random.Range(-location.x, location.x) + Random.Range(minRandomValue, maxRandomValue), location.y + Random.Range(minRandomValue, maxRandomValue));

        instance.transform.position = location;
        instance.SetText(text);

        if (IsCrit)
        {
            instance.SetFontSize(critFontsize);
            instance.SetColor(critColor);
        }

        if (damageType == DamageType.Fire)
        {
            instance.SetFontSize(effectsFontsize);
            instance.SetColor(fireColor);
        }

        if (damageType == DamageType.Bleeding)
        {
            instance.SetFontSize(effectsFontsize);
            instance.SetColor(bleedColor);
        }
    }
    public static void CreateDamagePopUp(string text, Vector3 location, DamageType damageType)
    {
        if (popUpText == null)
        {
            Initialize();
        }

        PopUpText instance = Instantiate(popUpText);

        instance.transform.SetParent(canvas.transform, false);

        Vector3 position = new Vector3(location.x + Random.Range(minRandomValue, maxRandomValue), location.y + Random.Range(minRandomValue, maxRandomValue), location.z + Random.Range(minRandomValue, maxRandomValue));

        instance.transform.position = location;
        instance.SetText(text);

        if (damageType == DamageType.Normal)
        {
            instance.SetFontSize(defaultFontSize);
            instance.SetColor(normalColor);
        }

        else if (damageType == DamageType.Fire)
        {
            instance.SetFontSize(smallerFontSize);
            instance.SetColor(fireColor);
        }
    }
Ejemplo n.º 3
0
        public PopUpText SpawnPopUpText(string str, Vector3 position, Color color)
        {
            PopUpText popUpTextPrefab = (PopUpText)Instantiate(m_PopUpTextPrefab,
                                                               position + m_PopUpTextOffset,
                                                               Quaternion.identity);

            popUpTextPrefab.SetText(str);
            popUpTextPrefab.SetColor(color);
            return(popUpTextPrefab);
        }