void ProcessHit(PH_DamageDealer damageDealer) { health -= damageDealer.GetDamage(); //take damage damageDealer.Hit(); //will destroy the foreign game object if (health <= 0) { Die(); } }
void ProcessHit(PH_DamageDealer damageDealer) { health -= damageDealer.GetDamage();//lower health by the amount from the damage dealer script damageDealer.Hit(); if (health <= 0) { Die(); } //if health reahed zero, die else if (health <= HealthFormChange && formIndex < 1) //or if health reached the critical point and enemy didn't change form yet { formIndex++; ChangeForm(); } //ChangeForm form and increase formIndex }