rabidus-test/Assets/Scripts/EndGameModule.cs

48 lines
1.2 KiB
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 LeanSize _sphere;
[SerializeField]
private UITextShow _textShow;
[SerializeField]
private UITextShow _textTimer;
[SerializeField]
private UIPanel _uiPanel;
public void ShowEndMenu(bool success)
{
_sphere.LeanAction();
_uiPanel.ShowPanel();
if (success)
{
_textShow.SetText(VicoryText);
}
else
{
_textShow.SetText(LoseText);
}
if (success)
{
if (GlobalSettings.Instance.AllMaps)
_textTimer.ShowTimer(3, string.Empty, 0, null, () => { BNG.SceneLoader.Instance.ChangeLevel(); });
else
_textTimer.ShowTimer(3, string.Empty, 0, null, () => { BNG.SceneLoader.Instance.LoadStartScene(); });
}
else
_textTimer.ShowTimer(3, string.Empty, 0, null, () => { BNG.SceneLoader.Instance.LoadStartScene(); });
}
}