public void PlayPopup(string amountStr, NumberPopupReason reason) { if (reason == NumberPopupReason.RemoveCoins || reason == NumberPopupReason.RemoveHearts) { amountStr = "-" + amountStr; } amountLabel.text = amountStr; amountShadowLabel.text = amountStr; if (reason == NumberPopupReason.Bad) { amountLabel.color = Color.red; icon.gameObject.SetActive(false); } else if (reason == NumberPopupReason.Good) { amountLabel.color = Color.green; icon.gameObject.SetActive(false); } else if (reason == NumberPopupReason.RemoveCoins) { amountLabel.color = Color.yellow; icon.sprite = coinImage; } else if (reason == NumberPopupReason.RemoveHearts) { amountLabel.color = Color.red; icon.sprite = heartImage; } StartCoroutine(PlayAnimation()); }
public void GeneratePopup(GameObject entity, int amount, NumberPopupReason reason, float delay = 0f) { amount = BadAtMathQuirk.ApplyQuirkIfPresent(amount); Vector3 position = entity.transform.position + Vector3.up * 0.7f; StartCoroutine(mInstance.GeneratePopupEnumerator(position, amount.ToString(), reason, delay)); }
private IEnumerator GeneratePopupEnumerator(Vector3 position, string text, NumberPopupReason reason, float delay) { if (delay > 0.01f) { yield return(new WaitForSeconds(delay)); } GameObject newPopup = GameObject.Instantiate(PrefabManager.instance.PrefabByName("NumberPopup")); newPopup.transform.position = position; newPopup.GetComponent <NumberPopup>().PlayPopup(text, reason); yield break; }
public void PlayPopup(int amount, NumberPopupReason reason) { PlayPopup(amount.ToString(), reason); }
public void GeneratePopup(GameObject entity, string text, NumberPopupReason reason, float delay = 0f) { Vector3 position = entity.transform.position + Vector3.up * 0.7f; StartCoroutine(mInstance.GeneratePopupEnumerator(position, text, reason, delay)); }
public void GeneratePopup(Vector3 position, string text, NumberPopupReason reason, float delay = 0f) { StartCoroutine(mInstance.GeneratePopupEnumerator(position, text, reason, delay)); }
public void GeneratePopup(Vector3 position, int amount, NumberPopupReason reason, float delay = 0f) { amount = BadAtMathQuirk.ApplyQuirkIfPresent(amount); StartCoroutine(mInstance.GeneratePopupEnumerator(position, amount.ToString(), reason, delay)); }