private void OnTriggerEnter(Collider collision) { BulletKills bk = collision.gameObject.GetComponentInParent <BulletKills>(); if (bk != null) { Debug.Log("Hit!"); if (!_damagedGuys.Contains(bk)) { _damagedGuys.Add(bk); bk.health -= Damage; Debug.Log("Whack!"); // Destroy(); } } }
private void OnCollisionEnter(Collision collision) { BulletKills bk = collision.gameObject.GetComponentInParent <BulletKills>(); Death de = collision.gameObject.GetComponentInParent <Death>(); if (!bEnemyProjectile && bk != null) { bk.TakeDamage(Damage); Destroy(); } else if (bEnemyProjectile && de != null) { de.TakeDamage(Damage); Destroy(); } else if (!(collision.gameObject.tag == "Player")) { Destroy(); } }