using UnityEngine;
using System.Collections;

public class Background : MonoBehaviour {

	// Use this for initialization
	void Start () {
		//Resize();

		SpriteRenderer sr = GetComponent<SpriteRenderer>();
		
		float worldScreenHeight = Camera.main.orthographicSize * 2;
		float worldScreenWidth = worldScreenHeight / Screen.height * Screen.width;
		
		transform.localScale = new Vector3(
			worldScreenWidth / sr.sprite.bounds.size.x,
			worldScreenHeight / sr.sprite.bounds.size.y, 1);

		Color[] colors = {
			new Color(233/255.0f,  84/255.0f,  27/255.0f), 
			new Color( 72/255.0f, 133/255.0f,  27/255.0f), 
			new Color( 72/255.0f, 133/255.0f, 164/255.0f),
			new Color(115/255.0f, 163/255.0f, 120/255.0f),
			new Color(115/255.0f, 163/255.0f, 199/255.0f),
			new Color(167/255.0f, 121/255.0f, 215/255.0f),
			new Color(167/255.0f, 121/255.0f, 106/255.0f),
			new Color(183/255.0f,  56/255.0f, 212/255.0f),
			new Color(236/255.0f, 177/255.0f,  74/255.0f),
		};
		Camera.main.backgroundColor = colors[Random.Range(0, colors.GetLength(0))];
	}
	
	// Update is called once per frame
	void Update () {
	
	}
}
