Exemple #1
0
    public override void TakeDamage(float damage)
    {
        if (newDamagePopup != null)
        {
            if (!newDamagePopup.IsActive())
            {
                newDamagePopup = ObjectPoolingManager.PopupPool.GetObject(popupTextPrefab, myCanvas.transform);
                newDamagePopup.transform.SetParent(myCanvas.transform, false);
                newDamagePopup.transform.localPosition = Vector3.zero;
                newDamagePopup.transform.localScale    = Vector3.one;
                newDamagePopup.SetDamage(damage);
            }
            else
            {
                newDamagePopup.SetDamage(damage);
            }
        }
        else
        {
            newDamagePopup = ObjectPoolingManager.PopupPool.GetObject(popupTextPrefab, transform);
            newDamagePopup.transform.SetParent(myCanvas.transform, false);
            newDamagePopup.transform.localPosition = Vector3.zero;
            newDamagePopup.transform.localScale    = Vector3.one;
            newDamagePopup.SetDamage(damage);
        }

        base.TakeDamage(damage);
    }