public void ManageDamage(DamageController damagecontroller) { // Applies damage to the health of this object health -= damagecontroller.GetDamage(); //Destroys the laser on collision damagecontroller.Hit(); //Destroys the object when the health is <= 0 if (health <= 0) { //Triggers death function TriggerDeath(); } }
private void ManageDamage(DamageController damagecontroller) { // Applies damage to the health of this object shield -= damagecontroller.GetDamage(); // Updates the health bar UpdateHealthBar(); // Destroys the laser on collision damagecontroller.Hit(); //Destroys the object when the health is <= 0 if (shield <= 0) { PlayerDie(); } }
private void VisualizeDamageNumbers(object sender, WeaponCollisionEventArgs args) { damageNumbers.text = dmgController.GetDamage().ToString(); //Instantiating Damage Numbers Instantiate(damageNumbers, args.Target.position + new Vector3(Random.Range(-0.25f, 0.25f), Random.Range(-0.25f, 0.25f), Random.Range(-0.25f, 0.25f)), Quaternion.LookRotation(mainCamera.transform.position - args.Target.position)); }