Files
bullet-hell-jam-2022/Assets/Scripts/Core/UIManager.cs
Minzkraut 84fb81e5c8 Scoreboard implementation part 1
Get scores from server
Submit score to server
Basic scoreboard scene
2022-04-24 13:32:15 +02:00

42 lines
1.2 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class UIManager : MonoBehaviour
{
public TextMeshProUGUI playerHealthLabel;
public TextMeshProUGUI gameOverLabel;
public TextMeshProUGUI scoreLabel;
public TextMeshProUGUI waveLabel;
public Button restartButton;
public Button scoreboardButton;
private GameManager gameManager;
// Start is called before the first frame update
void Start()
{
gameManager = FindObjectOfType<GameManager>();
}
// Update is called once per frame
void Update()
{
//round player health
playerHealthLabel.text = "Health: " + Mathf.Round(gameManager.player.health).ToString();
scoreLabel.text = "Score: " + Mathf.Round(gameManager.score).ToString();
waveLabel.text = "Wave: " + (gameManager.wave + 1).ToString();
if (gameManager.player.health <= 0)
{
gameOverLabel.gameObject.SetActive(true);
restartButton.gameObject.SetActive(true);
scoreboardButton.gameObject.SetActive(true);
}
}
}