using UnityEngine;
using System.Collections;

public class SceneHandler : MonoBehaviour {

	public bool showHandler = false;
	int currentScene = 0;

	void OnGUI () {

		currentScene = Application.loadedLevel;

		if(showHandler){

		// Make a background box
		if(currentScene == 0)
		GUI.Box(new Rect(10,10,100,90), "0. MenuScene");
		if(currentScene == 1)
		GUI.Box(new Rect(10,10,100,90), "1. CutScene");
		if(currentScene == 2)
		GUI.Box(new Rect(10,10,100,90), "2. MainScene");

		// Make the first button. If it is pressed, Application.Loadlevel (1) will be executed
		if(currentScene != 0){
		if(GUI.Button(new Rect(20,40,80,20), "<<")) {
			currentScene -= 1;
			Application.LoadLevel(currentScene);
		}
		}
		
		// Make the second button.
		if(currentScene != Application.levelCount - 1){
		if(GUI.Button(new Rect(20,70,80,20), ">>")) {
			currentScene += 1;
			Application.LoadLevel(currentScene);
		}
		}

		}
	}

	public void Awake()
	{
		DontDestroyOnLoad(this);
		
		if (FindObjectsOfType(GetType()).Length > 1)
		{
			Destroy(gameObject);
		}
	}

	// Use this for initialization
	void Start () {

	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
}
