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.
HighGroundRoyaleNetcode/Assets/Scripts/Gameplay/WarningPanel.cs

35 lines
700 B
C#

using Unity.Netcode;
using UnityEngine;
using System.Collections;
public class WarningPanel : NetworkBehaviour
{
public static WarningPanel Instance { get; private set; }
[SerializeField] private GameObject panel;
private void Awake()
{
if (Instance == null)
{
Instance = this;
}
else
{
Destroy(gameObject);
}
}
public void ShowPanel(float seconds)
{
panel.SetActive(true);
StartCoroutine(HidePanelAfterTime(seconds));
}
private IEnumerator HidePanelAfterTime(float seconds)
{
yield return new WaitForSeconds(seconds);
panel.SetActive(false);
}
}