Add main menu scene with Rive UI, procedural background, and scene transitions
- Add Menu scene with Rive-driven login and navigation UI (RiveLoginController, RiveNavigationController) for entering a username and starting/navigating the client via Rive triggers - Add SceneTransitionController to fade out and load the Landscape gameplay scene when Play is selected - Add procedural low-poly triangle field background and animated wave panel (LowPolyTriangleField, TriangleWavePanel) with matching editor menus and materials - Add MenuLightAnimator for animated menu lighting and UI fade helpers (MenuFadeIn, DebugFadeToggle/Bridge) - Rename SampleScene to Landscape and wire ChatNetworkManager to hide the new Rive login canvas once gameplay starts - Bump Input System action codegen version and add Rive package references/project settings updates to support the new UI
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
using System.IO;
|
||||
using Procedural;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ProceduralEditor
|
||||
{
|
||||
public static class LowPolyTriangleFieldMenu
|
||||
{
|
||||
const string MaterialsFolder = "Assets/Materials";
|
||||
const string FaceMaterialPath = MaterialsFolder + "/LowPolyTriangleFace.mat";
|
||||
const string EdgeMaterialPath = MaterialsFolder + "/LowPolyTriangleEdge.mat";
|
||||
|
||||
[MenuItem("Tools/Scene/Add Low Poly Triangle Field")]
|
||||
public static void CreateInScene()
|
||||
{
|
||||
var faceMaterial = GetOrCreateMaterial(FaceMaterialPath, "Universal Render Pipeline/Lit", mat =>
|
||||
{
|
||||
mat.SetColor("_BaseColor", new Color(0.09f, 0.11f, 0.14f));
|
||||
if (mat.HasProperty("_Smoothness")) mat.SetFloat("_Smoothness", 0.45f);
|
||||
if (mat.HasProperty("_Metallic")) mat.SetFloat("_Metallic", 0.05f);
|
||||
if (mat.HasProperty("_Cull")) mat.SetFloat("_Cull", 0f);
|
||||
});
|
||||
|
||||
var edgeMaterial = GetOrCreateMaterial(EdgeMaterialPath, "Universal Render Pipeline/Unlit", mat =>
|
||||
{
|
||||
mat.SetColor("_BaseColor", Color.white);
|
||||
if (mat.HasProperty("_Cull")) mat.SetFloat("_Cull", 0f);
|
||||
});
|
||||
|
||||
var go = new GameObject("Low Poly Triangle Field");
|
||||
Undo.RegisterCreatedObjectUndo(go, "Add Low Poly Triangle Field");
|
||||
go.transform.position = new Vector3(0f, -1.5f, 15f);
|
||||
go.transform.rotation = Quaternion.identity;
|
||||
|
||||
var field = go.AddComponent<LowPolyTriangleField>();
|
||||
field.faceMaterial = faceMaterial;
|
||||
field.edgeMaterial = edgeMaterial;
|
||||
|
||||
EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
|
||||
Selection.activeGameObject = go;
|
||||
if (SceneView.lastActiveSceneView != null)
|
||||
SceneView.lastActiveSceneView.FrameSelected();
|
||||
}
|
||||
|
||||
static Material GetOrCreateMaterial(string path, string shaderName, System.Action<Material> configure)
|
||||
{
|
||||
var existing = AssetDatabase.LoadAssetAtPath<Material>(path);
|
||||
if (existing != null) return existing;
|
||||
|
||||
if (!AssetDatabase.IsValidFolder(MaterialsFolder))
|
||||
AssetDatabase.CreateFolder("Assets", "Materials");
|
||||
|
||||
var shader = Shader.Find(shaderName);
|
||||
if (shader == null)
|
||||
{
|
||||
Debug.LogError($"LowPolyTriangleFieldMenu: could not find shader '{shaderName}'.");
|
||||
return null;
|
||||
}
|
||||
|
||||
var mat = new Material(shader);
|
||||
configure(mat);
|
||||
AssetDatabase.CreateAsset(mat, path);
|
||||
AssetDatabase.SaveAssets();
|
||||
return mat;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user