#pragma strict
//var asteroids = Array();
//var enemyspaceships = Array();
var numberOfAsteroids: int; 
var asteroidPrefab: Rigidbody;
var numberOfSpaceships: int;
var spaceshipPrefab: Rigidbody;
var boss1prefab: Rigidbody;
var SpaceShip: Rigidbody[] = new Rigidbody[1];
var spawn: int[] = new int[2];
var RandomSpaceShipSelect: int;
var RandomSpaceShip: Rigidbody;

function Update () {

	
}

function generateEnemies()
{	var rnd: int;
	for(var l: int in spawn)
	{
		rnd = Random.Range(0, spawn.Length);
	}
	for (var i = 0; i < numberOfAsteroids; i++)
	{
		var randomX = Random.Range(MovementController.Rightmost() + 10,MovementController.Rightmost() + rnd);
		var randomY = Random.Range(MovementController.Bottommost(), MovementController.Topmost());
		var randomX2 = Random.Range(MovementController.Rightmost() + 10,MovementController.Rightmost() + rnd);
		var randomY2 = Random.Range(MovementController.Bottommost(), MovementController.Topmost());			
		yield WaitForSeconds(3);
		Instantiate(RandomSpaceShip, Vector3(randomX, randomY,5), Quaternion.identity);
		Instantiate(asteroidPrefab, Vector3(randomX2, randomY2,5), Quaternion.identity);
	}
	Instantiate(boss1prefab, Vector3(16, 0, 5), Quaternion.identity);
}

function Start () {	
	spawn[0] = 51;
	spawn[1] = 49;
	RandomSpaceShipSelect = Random.Range(0,SpaceShip.Length); 
	RandomSpaceShip = SpaceShip[RandomSpaceShipSelect]; 
	yield generateEnemies();
}