Im having some confusion here, i have a trigger collider and i want if x number of enemies past trought this collider restart the game, and i try this but nothing hapen
#pragma strict
var numEnemies : int = 3;
function OnTriggerEnter2D(other: Collider2D)
{
if(other.CompareTag("Enemy")){
for(var i : int = 0; i > numEnemies; i++){
EndOfLevel();
}
}
}
function EndOfLevel(){
yield WaitForSeconds(2);
// ... and then reload the level.
Application.LoadLevel(Application.loadedLevel);
}
↧