A scripting question

So I just made this script:

var isDead = false;
function OnTriggerEnter(other : Collider) {
if(other.tag == “Bullet”) {
//Test log.
Debug.Log(“Enemy Down!”);
//Change the color of the enemy.
transform.renderer.material.color = Color.red;
//Tell computer that the enemy is dead.
isDead = true;

}
}

I put this on the targets I wanted to hit but I want to know if there’s any way I can check if they’re all dead and if they’re all dead, then put up a “You Win” screen. Any suggestions?

I came up with a little more complicated way of this:

Let’s say you got 5 enemies.

Make a new script and call it whatever you want.
Then add this to it:

static public var EnemiesDead = 0;

function Update(){
if(EnemiesDead == 5){ //you can set maximum enemies to as many enemies as you got!
  Debug.Log("You win!");
}
}

then on your Enemy code, you add this to function Update:

if(isDead == true){
ScriptYouCreatedName.EnemiesDead += 1;
}

If you named the script I wanted you to create for, let’s say EnemyCounter.js - then you would write:

EnemyCounter.EnemiesDead += 1;

static public means that it’s changeable from other scripts, which means you don’t have to use “GetComponent” stuff which I find complicated! And to access a variable from another script whcih you made static public, you just use the Scripts name then the Variable’s name. Like:
MyScript.MyVariable = true; ← if it’s a boolean!