37 lines
1.2 KiB
C#
37 lines
1.2 KiB
C#
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
|
||
/// <summary>
|
||
/// Панель бездействия во время боя.
|
||
/// Появляется через 45 секунд без активности игрока.
|
||
/// UIPanelId.id на объекте в сцене должен быть "BattlePause".
|
||
/// Навигация по кнопкам — через PlayerCursorUI (InputMode.UI).
|
||
/// </summary>
|
||
public class BattlePausePanel : MonoBehaviour
|
||
{
|
||
[SerializeField] private GameManager gameManager;
|
||
[SerializeField] private Button resumeButton;
|
||
[SerializeField] private Button exitButton;
|
||
|
||
private void Awake()
|
||
{
|
||
if (resumeButton != null) resumeButton.onClick.AddListener(OnResume);
|
||
if (exitButton != null) exitButton.onClick.AddListener(OnExit);
|
||
}
|
||
|
||
private void OnResume()
|
||
{
|
||
if (gameManager == null) return;
|
||
gameManager.HideBattlePause();
|
||
}
|
||
|
||
private void OnExit()
|
||
{
|
||
if (gameManager == null) return;
|
||
gameManager.HideBattlePause();
|
||
// endGame = true — кредиты НЕ возвращаются:
|
||
// игрок уже находился в бою, пауза сработала по бездействию
|
||
gameManager.MenuGame(true);
|
||
}
|
||
}
|