Ejemplo n.º 1
0
 public float TakeDamage(DamageSource source, float dealt)
 {
     if (GetHealth() > dealt)
     {
         SetHealth(GetHealth() - dealt);
         if (source != null)
         {
             source.DamageDealt(this, dealt);
         }
         return(dealt);
     }
     else
     {
         float tempHealth = GetHealth();
         SetHealth(0);
         if (source != null)
         {
             source.DamageDealt(this, tempHealth);
             source.EntityDestroyed(this);
         }
         Remove();
         return(tempHealth);
     }
 }