using UnityEngine;
using System.Collections;

public class SpawnButtons : MonoBehaviour 
{
	
	private int buttonWidth, buttonHeight, b0_x, b1_x, b2_x, b3_x, b4_x, b5_x, b6_x, bY, cWidth, cHeight, cX, cY, padding, bPad, rand;
	//public string name;

	public GameObject enemy;

	public Transform[] spawnPoints;


	void Start () 
	{
		padding = Screen.width/22;

		// Button size
		buttonWidth = Screen.width/14;
		buttonHeight = Screen.height/12;

		// Button positions
		bPad = buttonWidth/3;
		b3_x = ((Screen.width - (Screen.width/2)) - (buttonWidth/2));
		b4_x = b3_x + buttonWidth + bPad;
		b5_x = b4_x + buttonWidth + bPad;
		b6_x = b5_x + buttonWidth + bPad;
		b2_x = b3_x - buttonWidth - bPad;
		b1_x = b2_x - buttonWidth - bPad;
		b0_x = b1_x - buttonWidth - bPad;
		bY = padding/2;
	}

	
	void OnGUI ()
	{
		if (GUI.Button(new Rect(b0_x, bY, buttonWidth, buttonHeight), "0"))
		{
			Instantiate(enemy, new Vector3(spawnPoints[0].transform.position.x, spawnPoints[0].transform.position.y, transform.position.z), Quaternion.identity);
		}

		if (GUI.Button(new Rect(b1_x, bY, buttonWidth, buttonHeight), "1"))
		{
			Instantiate(enemy, new Vector3(spawnPoints[1].transform.position.x, spawnPoints[1].transform.position.y, transform.position.z), Quaternion.identity);
		}

		if (GUI.Button(new Rect(b2_x, bY, buttonWidth, buttonHeight), "2"))
		{
			Instantiate(enemy, new Vector3(spawnPoints[2].transform.position.x, spawnPoints[2].transform.position.y, transform.position.z), Quaternion.identity);
		}

		if (GUI.Button(new Rect(b3_x, bY, buttonWidth, buttonHeight), "3"))
		{
			Instantiate(enemy, new Vector3(spawnPoints[3].transform.position.x, spawnPoints[3].transform.position.y, transform.position.z), Quaternion.identity);
		}
		
		if (GUI.Button(new Rect(b4_x, bY, buttonWidth, buttonHeight), "4"))
		{
			Instantiate(enemy, new Vector3(spawnPoints[4].transform.position.x, spawnPoints[4].transform.position.y, transform.position.z), Quaternion.identity);
		}
		
		if (GUI.Button(new Rect(b5_x, bY, buttonWidth, buttonHeight), "5"))
		{
			Instantiate(enemy, new Vector3(spawnPoints[5].transform.position.x, spawnPoints[5].transform.position.y, transform.position.z), Quaternion.identity);
		}

		if (GUI.Button(new Rect(b6_x, bY, buttonWidth, buttonHeight), "6"))
		{
			Instantiate(enemy, new Vector3(spawnPoints[6].transform.position.x, spawnPoints[6].transform.position.y, transform.position.z), Quaternion.identity);
		}

	}
}











