// This function should be called by whoever deals damage to the barricade public void receiveDamage(int amount) { UI.S.PlaySound("Hit"); health -= amount; HitText.Create(this.transform.position, amount); checkHealth(); }
public void receiveDamage(int amount) { this.Health -= amount; HitText.Create(this.transform.position, amount); if (Health <= 0) { Destroy(this.gameObject); } }
public void receiveDamage(int amount) { if (type == UnitType.Balloon) { UI.S.PlaySound("FlyingHurt"); } else if (type == UnitType.Archer) { UI.S.PlaySound("FemaleHurt"); } else { UI.S.PlaySound("MaleHurt"); } this.health -= amount; HitText.Create(this.transform.position, amount); if (this.health <= 0) { //Death Destroy(this.gameObject); } }