43 lines
987 B
C#
43 lines
987 B
C#
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
public class SceneController : MonoBehaviour
|
|
{
|
|
// Method untuk me-restart scene (digunakan oleh tombol "Coba Lagi" pada CanvasGagal)
|
|
public void RestartScene()
|
|
{
|
|
ScoreScript.scoreValue = 0;
|
|
// Memuat ulang scene yang aktif sekarang
|
|
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
|
|
}
|
|
|
|
public void LoadMainMenu()
|
|
{
|
|
SceneManager.LoadScene("MainMenu");
|
|
}
|
|
|
|
public void LoadPilihanMateri()
|
|
{
|
|
SceneManager.LoadScene("PilihanMateri");
|
|
}
|
|
|
|
public void LoadPilihanTugas()
|
|
{
|
|
SceneManager.LoadScene("PilihanTugas");
|
|
}
|
|
|
|
public void LoadToScene(string sceneName)
|
|
{
|
|
SceneManager.LoadScene(sceneName);
|
|
}
|
|
|
|
public void CloseApp() {
|
|
Application.Quit();
|
|
|
|
// Jika di Editor, hentikan mode play
|
|
#if UNITY_EDITOR
|
|
UnityEditor.EditorApplication.isPlaying = false;
|
|
#endif
|
|
}
|
|
}
|