示例#1
0
    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());
    }
示例#2
0
    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));
    }
示例#3
0
    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;
    }
示例#4
0
 public void PlayPopup(int amount, NumberPopupReason reason)
 {
     PlayPopup(amount.ToString(), reason);
 }
示例#5
0
    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));
    }
示例#6
0
 public void GeneratePopup(Vector3 position, string text, NumberPopupReason reason, float delay = 0f)
 {
     StartCoroutine(mInstance.GeneratePopupEnumerator(position, text, reason, delay));
 }
示例#7
0
    public void GeneratePopup(Vector3 position, int amount, NumberPopupReason reason, float delay = 0f)
    {
        amount = BadAtMathQuirk.ApplyQuirkIfPresent(amount);

        StartCoroutine(mInstance.GeneratePopupEnumerator(position, amount.ToString(), reason, delay));
    }