/// <summary> /// Displays a hit text over the target character. /// </summary> /// <param name="target">The position of the character.</param> /// <param name="name">Name of the item picked.</param> /// <param name="amount">Amount of gold picked.</param> /// <param name="isValuable">Is picking a valuable?</param> /// <param name="infinite">The picked item is infinite?</param> public void DisplayPickupText(Vector3 target, string name, int amount = 0, bool isValuable = false, bool infinite = false) { GameObject textGO = GetText(); if (textGO == null) { return; } TextEFX textEFX = textGO.GetComponent <TextEFX>(); Assert.IsNotNull <TextEFX>(textEFX, "Could not find the TextEFX component in the text GO."); textEFX.TargetPos = target; textEFX.DisplayText = "+"; textEFX.DisplayText += (infinite)? "" : amount.ToString() + " "; textEFX.DisplayText += name + ((amount > 1)? "s" : ""); if (isValuable) { textEFX.SetupPickupGoldColorTrans(); } else { textEFX.SetupPickupItemColorTrans(); } textEFX.enabled = true; textGO.SetActive(true); }
public void DisplayEmotionText(Vector3 target, string text, GameObject textGOToBeUsed = null) { GameObject textGO; if (textGOToBeUsed == null) { textGO = GetText(); } else { textGO = textGOToBeUsed; } if (textGO == null) { return; } TextEFX textEFX = textGO.GetComponent <TextEFX>(); Assert.IsNotNull <TextEFX>(textEFX, "Could not find the TextEFX component in the text GO."); textEFX.TargetPos = target; textEFX.DisplayText = text; textEFX.SetupEmotionTextColorTrans(); textEFX.enabled = true; textGO.SetActive(true); }
/// <summary> /// Displays a hit text over the target character. /// </summary> /// <param name="target">The transform of the character.</param> /// <param name="damageValue">The damage value to be displayed.</param> public void DisplayHitText(Transform target, int damageValue) { GameObject textGO = GetText(); if (textGO == null) { return; } TextEFX textEFX = textGO.GetComponent <TextEFX>(); Assert.IsNotNull <TextEFX>(textEFX, "Could not find the TextEFX component in the text GO."); textEFX.TargetPos = target.position; if (damageValue > 0) { textEFX.DisplayText = damageValue.ToString(); } else { textEFX.DisplayText = "Block!"; } textEFX.SetupTakeHitColorTrans(); textEFX.enabled = true; textGO.SetActive(true); }
/// <summary> /// Displays a experience text over the target character. /// </summary> /// <param name="target">The transform of the character.</param> /// <param name="damageValue">The damage value to be displayed.</param> public void DisplayReceiveExpText(Transform target, int exp) { GameObject textGO = GetText(); if (textGO == null) { return; } TextEFX textEFX = textGO.GetComponent <TextEFX>(); Assert.IsNotNull <TextEFX>(textEFX, "Could not find the TextEFX component in the text GO."); textEFX.TargetPos = target.position; textEFX.DisplayText = "+" + exp + " Exp"; textEFX.SetupReceiveExpColorTrans(); textEFX.enabled = true; textGO.SetActive(true); }