public class DialogManager : MonoBehaviour
{
public GameObject dialogPanel;
private bool isDialogOpen;
public void OpenDialog()
{
isDialogOpen = true;
dialogPanel.SetActive(true);
}
public void CloseDialog()
{
isDialogOpen = false;
dialogPanel.SetActive(false);
}
void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
if (!isDialogOpen)
{
// Меняем состояние паузы
if (Time.timeScale == 1f)
{
Time.timeScale = 0f;
}
else
{
Time.timeScale = 1f;
}
}
}
}
}