44 lines
963 B
C#
44 lines
963 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
public class GameController : MonoBehaviour
|
|
{
|
|
private static GameController instance;
|
|
[SerializeField]
|
|
private string startScene, mainScene, endScene;
|
|
public static GameController Instance{
|
|
get{
|
|
if(instance is null)Debug.LogError("Game controller is null");
|
|
return instance;
|
|
}
|
|
}
|
|
|
|
private void Awake() {
|
|
instance = this;
|
|
DontDestroyOnLoad(this.gameObject);
|
|
}
|
|
|
|
public void StartGame(){
|
|
SceneManager.LoadScene(mainScene);
|
|
}
|
|
|
|
public void EndGame(){
|
|
Debug.Log("Game is over");
|
|
SceneManager.LoadScene(endScene);
|
|
}
|
|
|
|
public void QuitGame(){
|
|
Application.Quit();
|
|
}
|
|
|
|
public void Options(){
|
|
Debug.Log("Clicked options");
|
|
}
|
|
|
|
public void MainMenu(){
|
|
SceneManager.LoadScene(startScene);
|
|
}
|
|
}
|