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); } }
public void PopUp(int damage, Vector2 _position) { PopUpText _text = GCManager.Instantiate(DAMAGE_POPUP_GC_KEY).GetComponentInChildren <PopUpText>(); _text.SetText(damage.ToString()); _text.transform.position = _position; }
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 void CreatePopupText(string text, Transform location) { PopUpText instance = Instantiate(popUpTextPrefab); instance.transform.SetParent(canvas.transform, false); instance.transform.position = location.position; instance.SetText(text); }
public static void CreateDamageText(string text, Transform location) { PopUpText instance = Instantiate(damageText); Vector2 screenPosition = camera.WorldToScreenPoint(location.position); instance.transform.SetParent(canvas.transform, false); instance.transform.position = screenPosition; instance.SetText(text); }
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); }
public void CreatePopText(string text, Transform location) { PopUpText instance = Instantiate(popUpTextPreFab); //Vector2 screen_position = Camera.main.WorldToScreenPoint(location.position); Vector2 screen_position = new Vector2(location.position.x, location.position.y); instance.transform.SetParent(canvas.transform, false); instance.transform.position = screen_position; instance.SetText(text); }