public void HandleDamage(Collider co) { SoundLibrary.ResetPitch(GetComponent <AudioSource>()); if (!IsDead()) { if (Time.time >= damageTimeStamp) { if (!gameObject.GetComponent <Player>()) { SoundLibrary.varySoundPitch(GetComponent <AudioSource>(), 0.05f); } Bullet projGo = co.GetComponentInParent <Bullet>(); SetHealth(GetHealth() - projGo.GetDamage()); damageTimeStamp = Time.time + damageIFrameRate; if (!gameObject.CompareTag("Player") && gameObject.GetComponent <Unit>()) { GetComponent <AudioSource>().PlayOneShot(hurt); StartCoroutine(DamageFlicker()); } else if (gameObject.CompareTag("Player") && gameObject.GetComponent <Unit>()) { GetComponent <AudioSource>().PlayOneShot(sl.ChoosePlayerHurt()); } HandleDeath(co); } } }