rabidus-test/Assets/Scripts/EndGameModule.cs

45 lines
896 B
C#
Raw Normal View History

2023-08-22 15:41:12 +03:00
using BNG;
2023-08-15 17:38:54 +03:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class EndGameModule : MonoBehaviour
{
[TextArea]
public string VicoryText;
[TextArea]
public string LoseText;
[SerializeField]
private UITextShow _textShow;
2023-08-22 15:41:12 +03:00
[SerializeField]
private UITextShow _textTimer;
2023-08-15 17:38:54 +03:00
[SerializeField]
private UIPanel _uiPanel;
2023-08-22 15:41:12 +03:00
private SceneLoader _sceneLoader;
private void Awake()
{
_sceneLoader = FindObjectOfType<SceneLoader>();
}
2023-08-15 17:38:54 +03:00
public void ShowEndMenu(bool success)
{
_uiPanel.ShowPanel();
if (success)
{
_textShow.SetText(VicoryText);
}
else
{
_textShow.SetText(LoseText);
}
2023-08-22 15:41:12 +03:00
_textTimer.ShowTimer(3, string.Empty, 0, null, () => { _sceneLoader.LoadScene("ResultScene"); });
2023-08-15 17:38:54 +03:00
}
}