using UnityEngine;
using System.Collections;

public class HUD : MonoBehaviour
{
	Texture controls_tex = null;
	Texture rules_tex = null;
	float alpha = 0;

	void Start()
	{
		controls_tex = Resources.Load<Texture>("materials/controls");
		rules_tex = Resources.Load<Texture>("materials/rules");
	}

	void Update()
	{
		if (Time.time < 15)
		{
			alpha += Mathf.Min(1, 1.5f*Time.deltaTime)*(1-alpha);
		}
		else if (alpha > 0)
		{
			alpha -= Mathf.Min(1, 1.5f*Time.deltaTime)*alpha;
			if (alpha < 1.0e-6f) alpha = 0;
		}
	}

	void OnGUI()
	{
		if (alpha > 0)
		{
			GUI.color = new Color(1,1,1,alpha);
			GUI.DrawTexture(new Rect(16,16,384,384), controls_tex);
			GUI.DrawTexture(new Rect(Screen.width-400,Screen.height-400,384,384), rules_tex);
		}
	}
}
