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,74 @@
|
||||
using UnityEngine;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
[ExecuteAlways]
|
||||
[RequireComponent(typeof(Light))]
|
||||
public class MenuLightAnimator : MonoBehaviour
|
||||
{
|
||||
[Header("Rotation")]
|
||||
// Yaw oscillates around the base direction rather than spinning all the way around, so the
|
||||
// light never swings past the wall's edge into a back-lighting angle that goes dark.
|
||||
public float yawAmplitude = 35f;
|
||||
public float yawSpeed = 0.2f;
|
||||
public float pitchAmplitude = 10f;
|
||||
public float pitchSpeed = 0.35f;
|
||||
|
||||
[Header("Intensity & Color")]
|
||||
public float baseIntensity = 1.1f;
|
||||
public float intensityPulseAmount = 0.25f;
|
||||
public float pulseSpeed = 0.6f;
|
||||
public Color colorA = new Color(1f, 0.96f, 0.86f);
|
||||
public Color colorB = new Color(0.8f, 0.88f, 1f);
|
||||
|
||||
Light _light;
|
||||
float _baseYaw;
|
||||
float _basePitch;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
_light = GetComponent<Light>();
|
||||
Vector3 e = transform.eulerAngles;
|
||||
_baseYaw = e.y;
|
||||
_basePitch = e.x;
|
||||
#if UNITY_EDITOR
|
||||
EditorApplication.update -= EditorTick;
|
||||
if (!Application.isPlaying)
|
||||
EditorApplication.update += EditorTick;
|
||||
#endif
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
EditorApplication.update -= EditorTick;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
void EditorTick()
|
||||
{
|
||||
if (Application.isPlaying) return;
|
||||
Animate((float)EditorApplication.timeSinceStartup);
|
||||
}
|
||||
#endif
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (!Application.isPlaying) return;
|
||||
Animate(Time.time);
|
||||
}
|
||||
|
||||
void Animate(float time)
|
||||
{
|
||||
float yaw = _baseYaw + Mathf.Sin(time * yawSpeed) * yawAmplitude;
|
||||
float pitch = _basePitch + Mathf.Sin(time * pitchSpeed + 1.3f) * pitchAmplitude;
|
||||
transform.rotation = Quaternion.Euler(pitch, yaw, 0f);
|
||||
|
||||
if (_light == null) _light = GetComponent<Light>();
|
||||
_light.intensity = baseIntensity + Mathf.Sin(time * pulseSpeed) * intensityPulseAmount;
|
||||
float colorT = (Mathf.Sin(time * pulseSpeed * 0.5f) + 1f) * 0.5f;
|
||||
_light.color = Color.Lerp(colorA, colorB, colorT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9ff347d60077f4b47982b9f52057b495
|
||||
Reference in New Issue
Block a user