public void DamageShield(float damage_f = 0) { Rigidbody2D rb = GetComponentInParent <Rigidbody2D>(); if (damage_f > 0) { this.current_shield -= damage_f * total_upgrade_damage_resistance; } else { float kernetic_energy1 = UnityFunctions.Calc_Kinetic_Energy(rb); this.current_shield -= (kernetic_energy1 * 0.05f) * total_upgrade_damage_resistance; } }
public void DamageShip(float damage_f = 0) { Rigidbody2D rb = GetComponentInParent <Rigidbody2D>(); if (damage_f > 0) { //************************ //Shake camera if dieectly //************************ UnityFunctions.CameraShake(); this.current_health -= damage_f * total_upgrade_damage_resistance; } else { float kernetic_energy1 = UnityFunctions.Calc_Kinetic_Energy(rb); //***************************************** //Shake camera if we are hit by a explosion //***************************************** UnityFunctions.CameraShake(0.2f, (kernetic_energy1 * 0.05f)); this.current_health -= (kernetic_energy1 * 0.05f) * total_upgrade_damage_resistance; } this.SendAlert(enum_status.Danger, this.name + " is taking Damage!"); }