示例#1
0
 public void Damage(float damage)
 {
     hp -= (int)damage;
     DamageText.ShowDamageText(gameObject, damage);
     if (hp <= 0)
     {
         Destroy(gameObject);
     }
 }
示例#2
0
    public void Damage(float damage)
    {
        int damageRounded = (Mathf.FloorToInt(damage));

        DamageText.ShowDamageText(gameObject, damageRounded);
        integrity -= damageRounded;
        if (integrity <= 0)
        {
            Destroy(gameObject);
        }
        else
        {
            SetMaterialForDurability();
        }
    }