I have 6 boolean and condition which is almost same each other. Can i simply my code?
void OnTriggerEnter(Collider coll){
if (coll.gameObject.tag == "Pbiru"){
Destroy (this.gameObject);
if (destroy1 == true) {
Destroy (hit1.collider.gameObject);
}
if (destroy2 == true) {
Destroy (hit2.collider.gameObject);
}
if (destroy3 == true) {
Destroy (hit3.collider.gameObject);
}
if (destroy4 == true) {
Destroy (hit4.collider.gameObject);
}
if (destroy5 == true) {
Destroy (hit5.collider.gameObject);
}
if (destroy6 == true) {
Destroy (hit6.collider.gameObject);
}
}
}