void OnTriggerEnter(Collider other) { if (other.tag == "Boundary") { return; } if (explosion != null) { Instantiate(explosion, transform.position, transform.rotation); } if (other.tag == "Player") { if (gameController.playerInvincible) { gameController.AddScore(scoreValue); Destroy(gameObject); return; } else { Instantiate(playerExplosion, other.transform.position, other.transform.rotation); if (--gameController.playerLives <= 0) { gameController.GameOver(); } else { gameController.Respawn(); } gameController.livesText.text = "Lives: " + gameController.playerLives; } } gameController.AddScore(scoreValue); Destroy(other.gameObject); Destroy(gameObject); }