This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
mochapine64backup/MoCha/Assets/Scripts/SceneLoader.cs
2018-04-26 13:11:35 -05:00

45 lines
No EOL
1.2 KiB
C#

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 == "Goals"))
SceneManager.LoadScene ("Goals");
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;
}
}
}