2018-04-21 12:22:17 +02:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
2018-04-22 05:57:26 +02:00
|
|
|
|
public class UIController : MonoBehaviour {
|
2018-04-22 15:59:14 +02:00
|
|
|
|
|
2018-04-22 19:07:50 +02:00
|
|
|
|
GameObject score;
|
|
|
|
|
GameObject pauseMenu;
|
2018-04-22 00:22:56 +02:00
|
|
|
|
|
|
|
|
|
[SerializeField]
|
2018-04-22 19:07:50 +02:00
|
|
|
|
GameObject gameOverPanel;
|
2018-04-22 15:59:14 +02:00
|
|
|
|
|
|
|
|
|
[SerializeField]
|
|
|
|
|
private HealthbarController healthcontroller;
|
|
|
|
|
|
|
|
|
|
public void ShowPauseMenu() {
|
2018-04-22 05:57:26 +02:00
|
|
|
|
pauseMenu.SetActive(true);
|
2018-04-21 20:47:50 +02:00
|
|
|
|
}
|
2018-04-22 15:59:14 +02:00
|
|
|
|
|
|
|
|
|
public void ClosePauseMenu() {
|
2018-04-22 05:57:26 +02:00
|
|
|
|
pauseMenu.SetActive(false);
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-22 15:59:14 +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);
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-22 15:59:14 +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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ShowGameOverUI() {
|
2018-04-22 15:59:14 +02:00
|
|
|
|
if ( gameOverPanel != null ) {
|
2018-04-22 00:22:56 +02:00
|
|
|
|
Canvas gameOverCanvas = gameOverPanel.GetComponent<Canvas>();
|
|
|
|
|
Debug.Log("Loading Canvas");
|
|
|
|
|
|
2018-04-22 15:59:14 +02:00
|
|
|
|
if ( gameOverCanvas != null ) {
|
2018-04-22 00:22:56 +02:00
|
|
|
|
Debug.Log("Loaded Canvas");
|
2018-04-22 15:59:14 +02:00
|
|
|
|
gameOverCanvas.enabled = true;
|
2018-04-22 00:22:56 +02:00
|
|
|
|
} else {
|
|
|
|
|
Debug.Log("Gameover panel has no Canvas");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
Debug.Log("No game over panel assigned");
|
|
|
|
|
}
|
2018-04-22 05:57:26 +02:00
|
|
|
|
}
|
2018-04-22 15:59:14 +02:00
|
|
|
|
|
|
|
|
|
public void InitHealthController(Player ply) {
|
|
|
|
|
healthcontroller.SetPlayer(ply);
|
|
|
|
|
}
|
2018-04-21 12:22:17 +02:00
|
|
|
|
}
|
2018-04-21 14:26:17 +02:00
|
|
|
|
|