1
0
Fork 0
Bildschirmflausch-LD41/Assets/Scripts/UIController.cs

58 lines
1.3 KiB
C#
Raw Normal View History

2018-04-21 12:22:17 +02:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UIController : MonoBehaviour {
private GameObject score;
2018-04-22 00:22:56 +02:00
private GameObject pauseMenu;
[SerializeField]
private GameObject gameOverPanel;
// Use this for initialization
2018-04-21 20:47:50 +02:00
void Start () {
2018-04-21 12:22:17 +02:00
}
// Update is called once per frame
void Update () {
}
public static UIController instance;
public void ShowPauseMenu()
{
pauseMenu.SetActive(true);
2018-04-21 20:47:50 +02:00
}
public void ClosePauseMenu()
{
pauseMenu.SetActive(false);
}
2018-04-21 22:32:53 +02:00
public void LoadSceneByIndex(int index)
{
2018-04-22 00:22:56 +02:00
Debug.Log("Loaded scene " + index);
2018-04-21 22:32:53 +02:00
UnityEngine.SceneManagement.SceneManager.LoadScene(index);
}
public void QuitGame()
{
2018-04-22 00:22:56 +02:00
Debug.Log("Quit game");
2018-04-21 22:32:53 +02:00
Application.Quit();
2018-04-22 00:22:56 +02:00
}
public void ShowGameOverUI() {
if (gameOverPanel != null) {
Canvas gameOverCanvas = gameOverPanel.GetComponent<Canvas>();
Debug.Log("Loading Canvas");
if (gameOverCanvas != null) {
Debug.Log("Loaded Canvas");
gameOverCanvas.enabled = true;
} else {
Debug.Log("Gameover panel has no Canvas");
}
} else {
Debug.Log("No game over panel assigned");
}
}
2018-04-21 12:22:17 +02:00
}
2018-04-21 14:26:17 +02:00