Reworks multiple shaders and materials for URP compatibility and adds a Loading screen/scene and a few model imports. Key changes: - Converted ProBuilder standard vertex-color shader and several particle/surface shaders to URP HLSL passes (UniversalForward, ShadowCaster, Depth, DepthNormals) preserving base texture * tint * vertex color, normal map and PBR parameters. - Updated particle SurfaceShader_VC to a URP forward pass and simplified lighting to use URP shader library helpers. - Updated materials (landMark, tile) to point to project textures, adjust keywords/flags (e.g. XRMotionVectorsPass, disable ShadowCaster for one), tweak tiling and base color values. - Added a Loading screen UI (UXML, USS) and LoadingScreenController.cs plus a new Loading scene and scene metadata. - Imported new FBX assets (T-Pose, Untitled) and updated Editor build settings / project settings to include the new Loading scene. These changes migrate rendering code to the Universal Render Pipeline and add a basic loading UI/scene, while updating materials and project settings accordingly.
66 lines
1.7 KiB
C#
66 lines
1.7 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UIElements;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
public class MainMenuController : MonoBehaviour
|
|
{
|
|
private UIDocument _doc;
|
|
private Button _playButton;
|
|
private Button _settingsButton;
|
|
private Button _exitButton;
|
|
|
|
[Header("Sonidos del Menú")]
|
|
public AudioClip hoverSound;
|
|
public AudioClip clickSound;
|
|
private AudioSource _audioSource;
|
|
|
|
private void Awake()
|
|
{
|
|
_doc = GetComponent<UIDocument>();
|
|
var root = _doc.rootVisualElement;
|
|
|
|
_audioSource = gameObject.AddComponent<AudioSource>();
|
|
|
|
_playButton = root.Q<Button>("BtnPlay");
|
|
_settingsButton = root.Q<Button>("BtnSettings");
|
|
_exitButton = root.Q<Button>("BtnExit");
|
|
|
|
_playButton.clicked += OnPlayClicked;
|
|
_settingsButton.clicked += OnSettingsClicked;
|
|
_exitButton.clicked += OnExitClicked;
|
|
|
|
_playButton.RegisterCallback<PointerEnterEvent>(OnButtonHover);
|
|
_settingsButton.RegisterCallback<PointerEnterEvent>(OnButtonHover);
|
|
_exitButton.RegisterCallback<PointerEnterEvent>(OnButtonHover);
|
|
}
|
|
|
|
private void OnButtonHover(PointerEnterEvent evt)
|
|
{
|
|
if (hoverSound != null) _audioSource.PlayOneShot(hoverSound);
|
|
}
|
|
|
|
private void PlayClickSound()
|
|
{
|
|
if (clickSound != null) _audioSource.PlayOneShot(clickSound);
|
|
}
|
|
|
|
private void OnPlayClicked()
|
|
{
|
|
PlayClickSound();
|
|
Debug.Log("Cargando SampleScene...");
|
|
SceneManager.LoadScene("Loading");
|
|
}
|
|
|
|
private void OnSettingsClicked()
|
|
{
|
|
PlayClickSound();
|
|
Debug.Log("Abriendo ajustes...");
|
|
}
|
|
|
|
private void OnExitClicked()
|
|
{
|
|
PlayClickSound();
|
|
Debug.Log("Saliendo...");
|
|
Application.Quit();
|
|
}
|
|
} |