void OnTriggerEnter(Collider other) { if (other.tag != "Boundary" && (other.tag == "Bolt" || other.tag == "Player" || other.tag == "All Clear")) { if (tag != "Enemy_Jet") { Instantiate(explosion, transform.position, transform.rotation); } if (other.tag == "Player") { playerController.set_life(playerController.get_life() - 1); if (playerController.get_life() < 1) { Instantiate(player_explosion, transform.position, transform.rotation); gameController.Game_is_over(); Destroy(other.gameObject); } } if (tag == "Mines") { gameController.Add_Score(mine_score_value); } else if (tag == "Goblin") { gameController.Add_Score(goblin_score_value); } else { gameController.Add_Score(jet_score_value); } if (other.tag != "Player" && other.tag != "All Clear") { Destroy(other.gameObject); } if (tag == "Enemy_Jet") { int i = GetComponent <Enemy_life>().get_life(); Instantiate(explosion, transform.position, transform.rotation); if (i > 1 && other.tag != "All Clear") { GetComponent <Enemy_life>().set_life(i - 1); } else { Destroy(gameObject); } } else { Destroy(gameObject); } } }
private void OnTriggerEnter(Collider other) { if (other.tag == "Boundary") { return; } Instantiate(Explosion, transform.position, transform.rotation); if (other.tag == "Player") { Instantiate(Player_Explosion, other.transform.position, other.transform.rotation); ScoreValue = 0; } gameController.Add_Score(ScoreValue); Destroy(other.gameObject); Destroy(gameObject); }
void OnTriggerEnter(Collider other) { if (other.CompareTag("Boundary") || other.CompareTag("Enemy")) { return; } if (explosion != null) { Instantiate(explosion, transform.position, transform.rotation); } if (other.tag == "Player") { Instantiate(Player_explosion, other.transform.position, other.transform.rotation); gamecontroller.Game_Over(); } Destroy(other.gameObject); Destroy(gameObject); gamecontroller.Add_Score(scoreValue); }