rabidus-test/Assets/EndGameModule.cs

45 lines
896 B
C#

using BNG;
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;
[SerializeField]
private UITextShow _textTimer;
[SerializeField]
private UIPanel _uiPanel;
private SceneLoader _sceneLoader;
private void Awake()
{
_sceneLoader = FindObjectOfType<SceneLoader>();
}
public void ShowEndMenu(bool success)
{
_uiPanel.ShowPanel();
if (success)
{
_textShow.SetText(VicoryText);
}
else
{
_textShow.SetText(LoseText);
}
_textTimer.ShowTimer(3, string.Empty, 0, null, () => { _sceneLoader.LoadScene("ResultScene"); });
}
}