#pragma strict
var numberOfAsteroids: int; 
var asteroidPrefab: Rigidbody;
var numberOfSpaceships: int;
var spaceshipPrefab: Rigidbody;
var boss1prefab: Rigidbody;
var enemySpaceShip2Prefab: Rigidbody;
var boss2prefab: Rigidbody;

function Update () {

}

function generateEnemies()
{
	var randomX: float;
	var randomY: float;
	var randomX2: float;
	var randomY2: float;
	for (var i = 0; i < numberOfAsteroids; i++)
	{
		randomX = Random.Range(MovementController.Rightmost() + 10,MovementController.Rightmost() +50);
		randomY = Random.Range(MovementController.Bottommost(), MovementController.Topmost());
		randomX2 = Random.Range(MovementController.Rightmost() + 10,MovementController.Rightmost() +50);
		randomY2 = Random.Range(MovementController.Bottommost(), MovementController.Topmost());	
		yield WaitForSeconds(3);
		Instantiate(spaceshipPrefab, Vector3(randomX, randomY,5), Quaternion.identity);
		Instantiate(asteroidPrefab, Vector3(randomX2, randomY2,5), Quaternion.identity);
	}
	Instantiate(boss1prefab, Vector3(16, 0, 5), Quaternion.identity);
	
	for (var y = 0; y < 20; y++)
	{			
		randomX = Random.Range(MovementController.Rightmost() + 10,MovementController.Rightmost() +50);
		randomY = Random.Range(MovementController.Bottommost(), MovementController.Topmost());
		randomX2 = Random.Range(MovementController.Rightmost() + 10,MovementController.Rightmost() +50);
		randomY2 = Random.Range(MovementController.Bottommost(), MovementController.Topmost());	
		yield WaitForSeconds(3);
		Instantiate(spaceshipPrefab, Vector3(randomX, randomY,5), Quaternion.identity);
		Instantiate(asteroidPrefab, Vector3(randomX2, randomY2,5), Quaternion.identity);
		Instantiate(enemySpaceShip2Prefab, Vector3(randomX2, randomY2,5), Quaternion.identity);
	}
	Instantiate(boss2prefab, Vector3(16, 0, 5), Quaternion.identity);
}

function Start () {	
	yield generateEnemies();
}