Add VS Code workspace/launch/settings for Unity development and a new MainMenu scene/UI (uxml, uss, tss) with MainMenuController and related assets. Import two alien character FBX models (with generated .meta settings) and add folder metadata. Update Git LFS pointers for a Game Kit scene and add modifications to Game Kit Controller assets (World Canvas material and Save Camera render texture) and ProjectSettings/QualitySettings. These changes bring initial UI/menu assets and character models into the project and add editor tooling/config for easier development.
46 lines
1.3 KiB
C#
46 lines
1.3 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UIElements; // Necesario para UI Toolkit
|
|
using UnityEngine.SceneManagement; // Para cambiar de escena
|
|
|
|
public class MainMenuController : MonoBehaviour
|
|
{
|
|
private UIDocument _doc;
|
|
private Button _playButton;
|
|
private Button _settingsButton;
|
|
private Button _exitButton;
|
|
|
|
private void Awake()
|
|
{
|
|
// Obtenemos la referencia al documento
|
|
_doc = GetComponent<UIDocument>();
|
|
var root = _doc.rootVisualElement;
|
|
|
|
// Buscamos los botones por su nombre (el que pusimos en el UXML)
|
|
_playButton = root.Q<Button>("BtnPlay");
|
|
_settingsButton = root.Q<Button>("BtnSettings");
|
|
_exitButton = root.Q<Button>("BtnExit");
|
|
|
|
// Asignamos las funciones a los eventos Click
|
|
_playButton.clicked += OnPlayClicked;
|
|
_settingsButton.clicked += OnSettingsClicked;
|
|
_exitButton.clicked += OnExitClicked;
|
|
}
|
|
|
|
private void OnPlayClicked()
|
|
{
|
|
Debug.Log("¡BWAAAH! Iniciando juego...");
|
|
// SceneManager.LoadScene("GameScene");
|
|
}
|
|
|
|
private void OnSettingsClicked()
|
|
{
|
|
Debug.Log("Abriendo ajustes...");
|
|
// Aquí podrías activar un panel superpuesto
|
|
}
|
|
|
|
private void OnExitClicked()
|
|
{
|
|
Debug.Log("Saliendo...");
|
|
Application.Quit();
|
|
}
|
|
} |