private void OnTriggerEnter(Collider other) { if (other.tag == "Boundary") { return; } if (other.tag == "Player") { Instantiate(playerExplosion, other.transform.position, other.transform.rotation); gameController.GameOver(); } if (hitPoints == 0) { Instantiate(asteroidExplosion, transform.position, transform.rotation); gameController.AddScore(scoreValue); Destroy(gameObject); } else { hitPoints = hitPoints - 1; } Destroy(other.gameObject); }
private void OnTriggerEnter(Collider other) { if (other.tag == "boundery") { return; } Instantiate(explosion, transform.position, transform.rotation); if (other.tag == "Player") { Instantiate(playerExplosion, other.transform.position, other.transform.rotation); gameController.GameOver(); } gameController.AddScore(scoreValue); Destroy(other.gameObject); Destroy(gameObject); }