2018-04-10 12:44:50 -05:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.SceneManagement;
|
|
|
|
|
using System.Collections;
|
2018-04-12 11:10:33 -05:00
|
|
|
|
using UnityEngine.UI;
|
2018-04-10 12:44:50 -05:00
|
|
|
|
|
|
|
|
|
public class SceneLoader : MonoBehaviour {
|
|
|
|
|
|
2018-04-12 11:10:33 -05:00
|
|
|
|
Text buttontext;
|
|
|
|
|
|
|
|
|
|
public void Start()
|
|
|
|
|
{
|
|
|
|
|
buttontext = GetComponentInChildren<Text> ();
|
2018-04-26 11:23:43 -05:00
|
|
|
|
// 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);
|
2018-04-12 11:10:33 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void LoadScene()
|
2018-04-10 12:44:50 -05:00
|
|
|
|
{
|
2018-04-12 11:10:33 -05:00
|
|
|
|
string scenetext = buttontext.text;
|
2018-04-19 14:38:04 -05:00
|
|
|
|
Debug.Log (" " + scenetext);
|
2018-04-12 11:10:33 -05:00
|
|
|
|
|
|
|
|
|
switch (scenetext) {
|
2018-04-21 19:03:58 -05:00
|
|
|
|
case "Start":
|
|
|
|
|
if (!(SceneManager.GetActiveScene ().name == "Home"))
|
|
|
|
|
SceneManager.LoadScene ("Home");
|
2018-04-12 11:10:33 -05:00
|
|
|
|
break;
|
|
|
|
|
case "Run":
|
2018-04-26 13:11:35 -05:00
|
|
|
|
if (!(SceneManager.GetActiveScene ().name == "Goals"))
|
|
|
|
|
SceneManager.LoadScene ("Goals");
|
2018-04-12 11:10:33 -05:00
|
|
|
|
break;
|
2018-04-26 09:37:47 -05:00
|
|
|
|
case "Profile":
|
|
|
|
|
if (!(SceneManager.GetActiveScene ().name == "Stats"))
|
|
|
|
|
SceneManager.LoadScene ("Stats");
|
|
|
|
|
break;
|
|
|
|
|
case "Monster Creator":
|
|
|
|
|
if (!(SceneManager.GetActiveScene ().name == "MonsterCreator"))
|
|
|
|
|
SceneManager.LoadScene ("MonsterCreator");
|
|
|
|
|
break;
|
2018-04-12 11:10:33 -05:00
|
|
|
|
default:
|
2018-04-12 13:38:53 -05:00
|
|
|
|
if (!(SceneManager.GetActiveScene ().name == scenetext))
|
|
|
|
|
SceneManager.LoadScene (scenetext);
|
2018-04-12 11:10:33 -05:00
|
|
|
|
break;
|
|
|
|
|
}
|
2018-04-10 12:44:50 -05:00
|
|
|
|
}
|
|
|
|
|
}
|