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

35 lines
747 B
C#
Raw Normal View History

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> ();
}
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) {
case "Home":
2018-04-12 13:38:53 -05:00
if (!(SceneManager.GetActiveScene ().name == "Main"))
SceneManager.LoadScene ("Main");
2018-04-12 11:10:33 -05:00
break;
case "Run":
2018-04-12 13:38:53 -05:00
if (!(SceneManager.GetActiveScene ().name == "StepCounter"))
SceneManager.LoadScene ("StepCounter");
2018-04-12 11:10:33 -05:00
break;
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
}
}