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

public class SceneLoader : MonoBehaviour {

	Text buttontext;

	public void Start()
	{
		buttontext = GetComponentInChildren<Text> ();
	}

	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;
		default:
			if (!(SceneManager.GetActiveScene ().name == scenetext))
				SceneManager.LoadScene (scenetext);
			break;
		}
	}
}