diff --git a/Assets/Scripts/Managers/HUDisplay.cs b/Assets/Scripts/Managers/HUDisplay.cs new file mode 100644 index 0000000000000000000000000000000000000000..237644352bdcb7c4891b891cb32a6f90fb3777f8 --- /dev/null +++ b/Assets/Scripts/Managers/HUDisplay.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using UnityEngine; +using UnityEngine.UI; // For Text + +public class HUDisplay : MonoBehaviour +{ + public GameObject messagePanel; + private Text textComponent; + [SerializeField] GameObject textInput; + + private void Start() + { + // Find Text element on screen + textComponent = messagePanel.transform.Find("Text").GetComponent<Text>(); + + // False as default + messagePanel.SetActive(false); + textInput.SetActive(false); + } + + public void OpenPanel(string text) + { + textComponent.text = text; + messagePanel.SetActive(true); + StartCoroutine(delayExec(2)); + } + + public void ClosePanel() + { + messagePanel.SetActive(false); + } + + public void OpenInput() + { + textInput.SetActive(true); + } + + public void CloseInput() + { + textInput.SetActive(false); + } + + private IEnumerator delayExec(int sec) + { + yield return new WaitForSeconds(sec); + ClosePanel(); + } +} diff --git a/Assets/Scripts/Managers/HUDisplay.cs.meta b/Assets/Scripts/Managers/HUDisplay.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..2064bc1d873149a7ecc95e6a7710ed29a56743a4 --- /dev/null +++ b/Assets/Scripts/Managers/HUDisplay.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: eac3a012263105c48916d88caefde15d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: