private void HpTextHook(float hpDiff) { GameObject go = ObjectPooler.Instance.SpawnFromPool(PooledEnum.FLOATING_TEXT, this.gameObject.transform.position + FloatingTextOffSet, Quaternion.identity); FloatingText text = go.GetComponent <FloatingText>(); text.SetText(hpDiff.ToString("F0"), hpDiff < 0 ? Color.red : Color.green); }
public static void CreateFloatingText(int text) { FloatingText instance = Instantiate(popupTextPrefab); instance.transform.SetParent(canvas.transform, false); instance.SetText(text); }
public static void CreateFloatingText(string text, Vector3 location) { FloatingText instance = ObjectPooler.Instance.FetchGO("PopupTextParent").GetComponent <FloatingText>(); instance.transform.SetParent(canvas.transform, false); instance.SetText(text, location); }
public void CreateFloatingText(string text, Transform location) { FloatingText instance = Instantiate(popupText); // instance.transform.SetParent(canvas.transform, false); instance.SetText(text); }
public static void CreateFloatingText(string text) { FloatingText instance = Instantiate(itemText); instance.transform.SetParent(canvas.transform, false); instance.SetText(text); }
void FloatingText(string message) { FloatingText popupText = Resources.Load <FloatingText>("Prefabs/PopupTextParent"); FloatingText instance = Instantiate(popupText); instance.transform.SetParent(transform, false); instance.SetText(message); }
public static void CreateFloatingCriticalText(string text, Transform location) { FloatingText instance = Instantiate(popupText2); instance.transform.SetParent(canvas.transform, false); instance.transform.SetAsFirstSibling(); instance.SetText(text); }
public void CreateFloatingText(string text, int currentMultiplier, Vector2 location) { Vector2 screenPos = Camera.main.WorldToScreenPoint(location); GameObject newPopup = Instantiate(popupTextPrefab, screenPos, Quaternion.identity, popupParent); FloatingText fl = newPopup.GetComponent <FloatingText>(); fl.childForPositioning.transform.position = screenPos; fl.SetText(text, multiplierColors[currentMultiplier]); }
static void CreateFloatingText(GameObject _canvas, string text, Transform location, FloatingText _floatingText) { FloatingText _instance = Instantiate(_floatingText); Vector2 textPosition = new Vector2(location.position.x + 0.5f, location.position.y); _instance.transform.SetParent(_canvas.transform, false); _instance.transform.position = textPosition; _instance.SetText(text); }
static void CreateText(string text, FloatingText _floatingText) { FloatingText _instance = Instantiate(_floatingText); Vector2 textPosition = new Vector2(_messagesLocation.transform.position.x + 0.5f, _messagesLocation.transform.position.y); _instance.transform.SetParent(_canvas.transform, false); _instance.transform.position = textPosition; _instance.SetText(text); }
public static void CreateFloatingEnemyText(string text) { parentObject = GameObject.Find("BattleSystem").GetComponent <BattleController> ().enemyHealthBar; popupText = Resources.Load <FloatingText> ("PopupTextParent"); FloatingText instance = Instantiate(popupText); instance.transform.SetParent(parentObject.transform, false); instance.SetText(text); }
public static void CreateFloatingText(string text, Transform location) { FloatingText instance = Instantiate(popupDistanceText); Vector2 screenPosition = Camera.main.WorldToScreenPoint(new Vector2(location.position.x, location.position.y + 2)); instance.transform.SetParent(canvas.transform, false); instance.transform.position = screenPosition; instance.SetText(text); }
public static void CreateTXT(string Damage, Transform location) { FloatingText instance = Instantiate(popuptext); Vector2 screenpos = Camera.main.WorldToScreenPoint(location.position); instance.transform.SetParent(canvas.transform, false); instance.transform.position = screenpos; instance.SetText(Damage); }
public static void CreateFloatingTextPoison(string text, Transform location) { FloatingText instance = Instantiate(PopUpTextPoison); Vector2 screenPosition = Camera.main.WorldToScreenPoint(location.position); instance.transform.SetParent(canvas.transform, false); instance.transform.position = screenPosition; instance.SetText(text); }
public static void CreateFloatingText(string text, Transform location) { FloatingText instance = Instantiate(popupText); Vector2 screenPosition = Camera.main.WorldToScreenPoint(new Vector3(-.5f + location.position.x + Random.Range(-.2f, .2f), 0, .5f + location.position.z + Random.Range(-.2f, .2f))); instance.transform.SetParent(textParent.transform, false); instance.transform.position = screenPosition; instance.SetText(text); }
public static void CreateFloatingText(string text, Transform location) { FloatingText instance = Instantiate(popupText, location.position, Quaternion.identity); Vector2 screenPosition = Camera.main.WorldToScreenPoint(new Vector2(location.position.x + Random.Range(-.2f, .2f), location.position.y + Random.Range(-.2f, .2f))); instance.transform.SetParent(canvas.transform, false); instance.transform.position = screenPosition; instance.SetText(text); }
public void CreateFloatingText(string text, Transform location) { FloatingText instance = Instantiate(popupText).GetComponentInChildren <FloatingText>(); Vector2 screenPoint = Camera.main.WorldToScreenPoint(location.position); instance.transform.SetParent(canvas.transform, false); instance.transform.position = screenPoint; instance.SetText(text); }
public void CreateFloatingText(string text, Transform location, Color textColor) { FloatingText instance = Instantiate(floatingText); Vector2 screenPosition = Camera.main.WorldToScreenPoint(new Vector2(location.position.x + Random.Range(-0.5f, 0.5f), location.position.y + 1.5f + Random.Range(-0.5f, 0.5f))); instance.transform.SetParent(canvas.transform, false); instance.transform.position = screenPosition; instance.SetText(text, textColor); }
public static void CreatePopupText(string text, Transform sourcePosition) { FloatingText instance = Instantiate(textPrefab); Vector2 screenPosition = Camera.main.WorldToScreenPoint(sourcePosition.position); instance.SetText(text); instance.transform.SetParent(canvas.transform, false); instance.transform.position = screenPosition; }
//For handling popup damage text public void CreateFloatingText(string text, Transform location, Vector3 pos, bool damage) { FloatingText instance = (FloatingText)PoolableMonoBehaviour.GetPoolable(PopupDmgText); instance.SetType(damage); instance.transform.SetParent(NonintUi.transform, false); instance.transform.position = pos; instance.SetText(text); instance.StartAnimating(); }
public void CreateFloatingText(Object sender, string damage) { Health senderHP = (Health)sender; FloatingText instance = Instantiate(popupText); instance.Position = new Vector3(senderHP.transform.position.x + Random.Range(-.05f, .05f), senderHP.transform.position.y + Random.Range(0.9f, 1.2f), senderHP.transform.position.z + 0.2f); instance.transform.SetParent(canvas.transform, false); instance.SetText(damage.ToString()); }
public static FloatingText CreateFloatingText(string text, Transform location) { FloatingText instance = Instantiate(popText); instance.location = location; instance.transform.SetParent(canvas.transform, false); instance.transform.SetSiblingIndex(0); instance.SetText(text); return(instance); }
public static void CreateFloatingText(string text, Transform location, float distance, bool crit) { FloatingText instance = Instantiate(popupText); instance.transform.SetParent(canvas.transform, false); instance.transform.position = screenPosition; // instance.SetColor(crit); instance.SetText(text); instance.SetSize(distance); }
//public static method to create floating Text (Override method, color can be chosen) public static void CreateFloatingText(string text, Transform position, Color color) { FloatingText instance = Instantiate(m_floatingText); Vector2 screenPosition = Camera.main.WorldToScreenPoint(position.position); instance.transform.SetParent(m_canvas.transform, false); instance.transform.position = screenPosition; instance.SetText(text); instance.SetColor(color); }
public static void CreateFloatingText(string text, Vector3 v) { Initialize(); FloatingText instance = Instantiate(popupText); instance.transform.SetParent(canvas.transform, true); instance.transform.position = new Vector3(v.x + 5, v.y, v.z + 5); instance.SetText(text); instance.indicator.color = Color.red; }
public void createBattleText(string text, Transform location, GameObject objectText) { FloatingText instance = Instantiate(objectText.GetComponent <FloatingText>()); Vector2 screenPosition = new Vector2(); screenPosition.Set(location.position.x, location.position.y + 1); instance.transform.SetParent(canvas.transform, false); instance.transform.position = screenPosition; instance.SetText(text); }
void ShowPoints(int points, Color col) { FloatingText pointsText = Resources.Load <FloatingText>("Prefabs/Prefab Objects/PopupPointsParent"); FloatingText instance = Instantiate(pointsText); instance.transform.SetParent(GameObject.Find("MainCanvas").transform, false); instance.transform.localPosition = transform.position; //GameObject.Find("MainCanvas").transform.position = transform.localPosition; instance.SetSize(POINTS_NOTICE_SIZE); //Not working for some reason instance.SetColor(col); //Not working for some reason instance.SetText(points.ToString()); }
private void FloatingText(Color color, string message, int font = 10, float speed = 1f) { FloatingText text = Instantiate(floatingTextPrefab); text.SetPosition(transform.position); text.SetColor(color); text.SetText(message); text.SetFont(font); text.SetLifeTime(1f); text.SetVelocity(new Vector2(0, speed)); }
public static void CreateFloatingMoneyText(string text, Transform location) { FloatingText instance = Instantiate(popupText3); instance.type = 2; Vector2 screenPosition = Camera.main.WorldToScreenPoint(new Vector2(location.position.x, location.position.y)); instance.transform.SetParent(canvas.transform, false); instance.SetLocation(location); instance.transform.SetAsFirstSibling(); instance.SetText(text); }
IEnumerator DelayMessage(string message) { if (GetComponentInParent <HeroManager>().GetComponentInChildren <OverheadText>().GetComponentInChildren <FloatingText>() != null) { yield return(new WaitForSeconds(0.5f)); } FloatingText popupText = Resources.Load <FloatingText>("Prefabs/PopupTextParent"); FloatingText instance = Instantiate(popupText); instance.transform.SetParent(transform, false); instance.SetText(message); }