You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
962 B
C#

1 week ago
using System;
using Unity.BossRoom.Utils;
using Unity.Netcode;
using UnityEngine;
namespace Unity.BossRoom.Gameplay.UI
{
/// <summary>
/// Class containing references to UI children that we can display. Both are disabled by default on prefab.
/// </summary>
public class UIStateDisplay : MonoBehaviour
{
[SerializeField]
UIName m_UIName;
[SerializeField]
UIHealth m_UIHealth;
public void DisplayName(NetworkVariable<FixedPlayerName> networkedName)
{
m_UIName.gameObject.SetActive(true);
m_UIName.Initialize(networkedName);
}
public void DisplayHealth(NetworkVariable<int> networkedHealth, int maxValue)
{
m_UIHealth.gameObject.SetActive(true);
m_UIHealth.Initialize(networkedHealth, maxValue);
}
public void HideHealth()
{
m_UIHealth.gameObject.SetActive(false);
}
}
}