Set object inactive in Hierarchy on collision help

Hello all. I have this script here that I made for a buildings health. The building has 5 green cubes to represent its health, and I want it to remove one each time the building is hit. What happens is nothing at all, and I don’t know why.

var healthBox1 : GameObject;
var healthBox2 : GameObject;
var healthBox3 : GameObject;
var healthBox4 : GameObject;
var healthBox5 : GameObject;

var healthEmpty  = false;

function Start (){

healthBox1.SetActive  (true);
healthBox2.SetActive  (true);
healthBox3.SetActive  (true);
healthBox4.SetActive  (true);
healthBox5.SetActive  (true);

}

function OnCollisionEnter () {

if (healthBox5.SetActive==true) 
healthBox5.SetActive (false);

if (healthBox4.SetActive==true && healthBox5.SetActive==false) 
healthBox4.SetActive (false);

if (healthBox3.SetActive==true && healthBox5.SetActive==false && healthBox4.SetActive==false) 
healthBox3.SetActive (false);

if (healthBox2.SetActive==true && healthBox5.SetActive==false && healthBox4.SetActive==false && healthBox3.SetActive==false) 
healthBox2.SetActive (false);

if (healthBox1.SetActive==true && healthBox5.SetActive==false && healthBox4.SetActive==false && healthBox3.SetActive==false && healthBox2.SetActive==false) 
healthBox1.SetActive (false);
healthEmpty = true;

}

I got it to work this way, so may as well post it here. My problem was it seems that OnCollisionEnter doesn’t like if statements, so I put them in an update and just tell the collision to mark a hit.

var healthBox2 : GameObject;
var healthBox3 : GameObject;
var healthBox4 : GameObject;
var healthBox5 : GameObject;

var healthEmpty  = false;
var hit = false;

var healthBox1Dead = false;
var healthBox2Dead = false;
var healthBox3Dead = false;
var healthBox4Dead = false;
var healthBox5Dead = false;



function OnCollisionEnter () {

hit = true;
}

function Update(){

if (hit == true){
healthBox5.SetActive (false);
healthBox5Dead = true;
hit = false;
}
if (hit == true && healthBox5Dead == true){
healthBox4.SetActive (false);
healthBox4Dead = true;
hit = false;
}
if (hit == true && healthBox4Dead == true){
healthBox3.SetActive (false);
healthBox3Dead = true;
hit = false;
}
if (hit == true && healthBox4Dead == true){
healthBox2.SetActive (false);
healthBox2Dead = true;
hit = false;
}
if (hit == true && healthBox4Dead == true){
healthBox1.SetActive (false);
healthBox1Dead = true;
var healthEmpty  = false;
hit = false;
print ("HQ Destroyed");
}
}