using System; using Unity.BossRoom.Gameplay.GameplayObjects.Character; using Unity.BossRoom.Utils; using Unity.Netcode; using UnityEngine; namespace Unity.BossRoom.Gameplay.UI { /// /// Class containing references to UI children that we can display. Both are disabled by default on prefab. /// public class UIStateDisplay : MonoBehaviour { public SwapConfirmationPanel swapConfirmationPanel; public string playerName; [SerializeField] UIName m_UIName; [SerializeField] UIHealth m_UIHealth; public void DisplayName(NetworkVariable networkedName) { m_UIName.gameObject.SetActive(true); m_UIName.Initialize(networkedName); playerName=networkedName.Value.ToString(); //var servercharacterName = GetComponentInParent(); //servercharacterName.name = playerName; swapConfirmationPanel.gameObject.name += networkedName.Value; } public void DisplayHealth(NetworkVariable networkedHealth, int maxValue) { m_UIHealth.gameObject.SetActive(true); m_UIHealth.Initialize(networkedHealth, maxValue); } public void HideHealth() { m_UIHealth.gameObject.SetActive(false); } } }