public void TakeDamage(float damageAmt) { if (shield != null) // if you have a shield { damageAmt = shield.AdjustDamage(damageAmt); //adjust the damage by the sheild amount } health -= damageAmt; //reduce helath by damage }
public void TakeDamage(float damageAmt) { if (shield != null) // if you have a shield { damageAmt = shield.AdjustDamage(damageAmt); //adjust the damage by the sheild amount } health -= damageAmt; //reduce helath by damage healthText.text = "Health: " + health; //update health display if (shield != null) // if you have a shield { healthText.text += "\nShield: " + shield.ToString(); //update health display to show shield name } }