Example #1
0
    public void TakeDamage(int damage)
    {
        currentHealth -= damage;

        damage = (int)UnityEngine.Random.Range(10f, 100f);
        // Spawn our popup damage text.
        popupText.SpawnPopupTextDamage(damage, 100, transform.position);

        if (currentHealth < 0)
        {
            //Destroy(gameObject);
        }

        OnHealthChanged(GetHealthPercentage());
    }