using System; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UIElements; using UnityEngine.UIElements.Experimental; namespace UnityRoyale { [RequireComponent(typeof(UIDocument))] public class EndScreen : MonoBehaviour { private const int AnimationDurationMs = 1000; [SerializeField] private string winnerTeamName; private Label matchOverLabel; private Label winnerIsLabel; private Label winnerTeamNameLabel; private Button mainMenuButton; private float matchOverLabelPosition; private float winnerIsLabelPosition; private float winnerTeamNameLabelPosition; public static void Show(EndScreen prefab, Transform parent, string winnerTeamName) { Instantiate(prefab, parent).winnerTeamName = winnerTeamName; } void OnEnable() { // Retrieving interesting elements to: // 1- set values // 2- assign behaviors // 3- animate! var rootVisualElement = GetComponent().rootVisualElement; matchOverLabel = rootVisualElement.Q