private void OnTriggerEnter(Collider other) { if (other.CompareTag("MayoShot") || other.CompareTag("KetShot")) { PlayerShotProperties shotProps = other.GetComponent <PlayerShotProperties>(); hitPoints -= shotProps.ReportDamage(); if ((other.CompareTag("MayoShot") && CompareTag("MayoEnemy")) || (other.CompareTag("KetShot") && CompareTag("KetEnemy"))) { GoodDestroyed(); } if ((other.CompareTag("KetShot") && CompareTag("MayoEnemy")) || (other.CompareTag("MayoShot") && CompareTag("KetEnemy"))) { BadDestroyed(); } DestroyBullet(other.gameObject, shotProps); } }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("PlayerShot")) { // We need to decrement the hitPoints by the damage of the playerShot // How can we define this? How can we get this? // Do we just have a PlayerShotProperties script? // We may need something like rb = GetComponent<Rigidbody>(); here? PlayerShotProperties shotProps = other.GetComponent <PlayerShotProperties>(); hitPoints -= shotProps.ReportDamage(); if (hitPoints <= 0) { GetDestroyed(); } // This will eventually need to test for piercing shots and not destroy the player shot if it // is a piercing shot. DestroyBullet(other.gameObject, shotProps); } }