creative-jam-20/Assets/Scripts/UIController.cs
Soulaha Balde ba99bbb4f0 Add MainMenu and pause menu
Transitions between menus work
2022-05-14 23:16:48 -04:00

47 lines
1.1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class UIController : MonoBehaviour
{
[SerializeField]private PlayerController player;
[SerializeField]private TMP_Text pointsTxt;
[SerializeField]private Transform pausePnl;
[SerializeField]private Transform optionsPnl;
// Start is called before the first frame update
void Start()
{
pausePnl.gameObject.SetActive(false);
optionsPnl.gameObject.SetActive(false);
}
// Update is called once per frame
void Update()
{
pointsTxt.text = player.GetPoints().ToString();
}
public void EnterPause(){
pausePnl.gameObject.SetActive(true);
}
public void ExitPause(){
pausePnl.gameObject.SetActive(false);
}
public void OnOptions(){
ExitPause();
optionsPnl.gameObject.SetActive(true);
}
public void OnBack(){
optionsPnl.gameObject.SetActive(false);
EnterPause();
}
public void OnQuit(){
Application.Quit();
}
}