59 lines
1.1 KiB
C#
59 lines
1.1 KiB
C#
using FishNet.Managing.Scened;
|
|
using Managers;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// Colleciton class for referencing and controlling HUD elements.
|
|
/// </summary>
|
|
public class HUD : MonoBehaviour
|
|
{
|
|
public BoostCapacityUI[] boostCapacities;
|
|
public JoinPrompt[] joinPrompts;
|
|
public TextMeshProUGUI score;
|
|
|
|
private Canvas canvas;
|
|
|
|
void Awake()
|
|
{
|
|
canvas = gameObject.GetComponent<Canvas>();
|
|
score.enabled = false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Start a join prompt.
|
|
/// </summary>
|
|
/// <param name="player">Player to which the prompt belongs</param>
|
|
public void StartJoinPrompt(Player player)
|
|
{
|
|
foreach (JoinPrompt jp in joinPrompts)
|
|
{
|
|
if (jp.playerNumber == player.playerNumber)
|
|
{
|
|
jp.gameObject.SetActive(true);
|
|
jp.PromptInput(player);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void UpdateScore(int newScore)
|
|
{
|
|
if (!score.enabled
|
|
&& GameManager.G.CurrentScene == SceneEnum.FreeFlyArena)
|
|
score.enabled = true;
|
|
|
|
score.text = $"Score: {newScore}";
|
|
}
|
|
|
|
public void Hide()
|
|
{
|
|
canvas.enabled = false;
|
|
}
|
|
|
|
public void Show()
|
|
{
|
|
canvas.enabled = true;
|
|
}
|
|
|
|
}
|