37 lines
739 B
C#
37 lines
739 B
C#
using UnityEngine;
|
|
|
|
public class MenuGameplayTransit : MonoBehaviour
|
|
{
|
|
[SerializeField] MenuLayoutController menu;
|
|
private void Update()
|
|
{
|
|
if (Input.GetKeyDown(KeyCode.Alpha1))
|
|
StartGame();
|
|
else if (Input.GetKeyDown(KeyCode.Alpha2))
|
|
GotoMenu();
|
|
|
|
}
|
|
public void StartGame()
|
|
{
|
|
menu.Close();
|
|
menu.OnTransitionFinished += OnClosed;
|
|
}
|
|
|
|
public void GotoMenu()
|
|
{
|
|
menu.Open();
|
|
menu.OnTransitionFinished += OnOpened;
|
|
}
|
|
|
|
private void OnOpened()
|
|
{
|
|
menu.OnTransitionFinished -= OnOpened;
|
|
print("Меню открыто");
|
|
}
|
|
|
|
private void OnClosed()
|
|
{
|
|
print("Меню закрыто");
|
|
}
|
|
}
|