using UnityEngine;
using UnityEngine.SceneManagement;
using System.Collections;
using UnityEngine.UI;

public class SceneLoader : MonoBehaviour {

	Text buttontext;

	public void Start()
	{
		buttontext = GetComponentInChildren<Text> ();
		// grab a UI element, set its rectTransform.anchoredPosition = to a Vector2 of the new position coordinates.
		//buttontext.rectTransform.anchoredPosition = new Vector2(buttontext.rectTransform.anchoredPosition.x, buttontext.rectTransform.anchoredPosition.y + 100);
	}

	public void LoadScene()
	{ 
		string scenetext = buttontext.text;
		Debug.Log (" " + scenetext);

		switch (scenetext) {
		case "Start":
			if (!(SceneManager.GetActiveScene ().name == "Home"))
				SceneManager.LoadScene ("Home");
			break;
		case "Run":
			if (!(SceneManager.GetActiveScene ().name == "StepCounter"))
				SceneManager.LoadScene ("StepCounter");
			break;
		case "Profile":
			if (!(SceneManager.GetActiveScene ().name == "Stats"))
				SceneManager.LoadScene ("Stats");
			break;
		case "Monster Creator":
			if (!(SceneManager.GetActiveScene ().name == "MonsterCreator"))
				SceneManager.LoadScene ("MonsterCreator");
			break;
		default:
			if (!(SceneManager.GetActiveScene ().name == scenetext))
				SceneManager.LoadScene (scenetext);
			break;
		}
	}
}