Load a scene/level when enemy is close...

Hi everyone!
I found this script (below) and attached it to an enemy who is following the player and once they collide, a level will load (in this case, I created a Death scene)

var levelToLoad : String;

function OnTriggerEnter(hit : Collider)
{
    Application.LoadLevel(levelToLoad);
}

The script actually worked, but I just realized it’s not working when my character is not moving which let the enemy revolve around my character until I start to walk then the level changes.

What I want to achieve though is something that would load a level once my enemy game object catches my character even in idle mode. Is it possible to load a scene through distances of game objects? If not, how can I load a scene with my character in idle animation? Really need some script for this…Thanks guys.

Here is the code I posted earlier, but for multiple enemies. Just be sure to tag each enemy with tag “enemy”.

var levelToLoad : String;
private var enemies : Array;
private var player;
var distance : float;
var killRange : float = 5.0;


function Start()
{
    player = transform;
    enemies = GameObject.FindGameObjectsWithTag("enemy");
}

function Update()
{
    enemies = GameObject.FindGameObjectsWithTag("enemy");
    for(var enemy : GameObject in enemies)
    {
		distance = Vector3.Distance(player.position, enemy.transform.position);
		if(distance <= killRange)
    		Application.LoadLevel(levelToLoad);
    }
}