this is the code iam using but cant figure out a way to make it short
public var health = 200;
function OnTriggerEnter(other:Collider){
var ammorPls: GameObject[] = GameObject.FindGameObjectsWithTag("ammor");
// Assign the builtin array to a js Array
var ammorPlsB = new Array (ammorPls);
if(other.tag=="bullet"){
health = health-10;
}
if(health<10) {
//remove ammor sections from range
for (var a = 0; a < 3; a++) {
ammorPlsB[a].rigidbody.isKinematic=false;
ammorPlsB[a].rigidbody.useGravity=true;
ammorPlsB[a].transform.parent = null;
ammorPlsB[a].collider.enabled=true;
}
}
if(health<20) {
//remove ammor sections from range
for (var b = 3; a < 6; a++) {
ammorPlsB**.rigidbody.isKinematic=false;**
ammorPlsB**.rigidbody.useGravity=true;**
ammorPlsB**.transform.parent = null;**
ammorPlsB**.collider.enabled=true;**
}
** }**
…