// Loading Screen Class
// This is another aethetic Core Component class. It can be called on demand and can be told to display just about any text that you'd want it to display.
//
// This should be made more of a singleton. For now, access it through GetInstance().
// Documentation kept to a minimum. The public functions describe themselves.
using UnityEngine;
using System.Collections;

[RequireComponent (typeof(GUITexture))]
[RequireComponent (typeof(GUIText))]
public class LoadingScreen : MonoBehaviour 
{	
	private static LoadingScreen Instance = null;
	
	public static bool isLoading
	{
		get {return Instance.enabled;}
		set {/*lol*/}
	}
	
	void Awake ()
	{
		Instance = this;
	}
	
	void Start () 
	{		
		Core.Attach(this);
		EndLoad ();
	}
	
	void Update () 
	{
	
	}
	
	public static void StartLoad()
	{
		Instance.GetComponent<GUIText>().enabled = true;
		Instance.GetComponent<GUITexture>().enabled = true;
		Instance.enabled = true;
		text = "Loading... ";
	}
	
	public static void EndLoad()
	{
		Instance.GetComponent<GUIText>().enabled = false;
		Instance.GetComponent<GUITexture>().enabled = false;
		Instance.enabled = false;
		text = "Loading... ";
	}
	
	public static void SetText(string s)
	{
		Instance.GetComponent<GUIText>().text = s;
	}
	
	public static string text
	{
		get { return Instance.GetComponent<GUIText>().text; }
		set { Instance.GetComponent<GUIText>().text = value; }
	}
	
}
