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

69 lines
1.4 KiB
C#
Raw Normal View History

2018-04-21 12:22:17 +02:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
2018-04-23 13:17:59 +02:00
using UnityEngine.SceneManagement;
2018-04-21 12:22:17 +02:00
2018-04-22 20:10:05 +02:00
public class UIController : MonoBehaviour
{
2018-04-22 19:07:50 +02:00
GameObject score;
GameObject pauseMenu;
2018-04-22 00:22:56 +02:00
2018-04-22 20:10:05 +02:00
[SerializeField]
NotificationManager notifications;
2018-04-22 00:22:56 +02:00
[SerializeField]
2018-04-22 19:07:50 +02:00
GameObject gameOverPanel;
[SerializeField]
2018-04-22 20:10:05 +02:00
HealthbarController healthcontroller;
2018-04-23 13:17:59 +02:00
[SerializeField]
int mainMenuSceneIndex = 0;
int firstSceneIndex = 1;
void Update() {
if (Input.GetKey(KeyCode.R) && GameController.instance.GameEnded()) {
LoadSceneByIndex(firstSceneIndex);
}
}
public void ShowPauseMenu() {
pauseMenu.SetActive(true);
2018-04-21 20:47:50 +02:00
}
2018-04-23 13:17:59 +02:00
public void ClosePauseMenu() {
pauseMenu.SetActive(false);
}
2018-04-23 13:17:59 +02:00
public void LoadSceneByIndex(int index) {
2018-04-22 00:22:56 +02:00
Debug.Log("Loaded scene " + index);
2018-04-23 13:17:59 +02:00
SceneManager.LoadScene(index);
2018-04-21 22:32:53 +02:00
}
2018-04-23 13:17:59 +02:00
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
}
2018-04-23 13:17:59 +02:00
public void ShowGameOverUI() {
if (gameOverPanel != null) {
Debug.Log("Loaded Canvas");
gameOverPanel.SetActive(true);
2018-04-22 00:22:56 +02:00
} else {
2018-04-22 00:22:56 +02:00
Debug.Log("No game over panel assigned");
}
}
2018-04-23 13:17:59 +02:00
public void InitHealthController(Player ply) {
healthcontroller.SetPlayer(ply);
}
2018-04-22 20:10:05 +02:00
public NotificationManager GetNotificationManager() {
return notifications;
}
2018-04-21 12:22:17 +02:00
}
2018-04-21 14:26:17 +02:00