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,50 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class DebugFadeToggle : MonoBehaviour
|
||||
{
|
||||
public Image targetImage;
|
||||
public float duration = 0.5f;
|
||||
|
||||
bool isVisible = true;
|
||||
Coroutine running;
|
||||
|
||||
void Start()
|
||||
{
|
||||
var btn = GetComponent<Button>();
|
||||
if (btn != null)
|
||||
btn.onClick.AddListener(ToggleFade);
|
||||
}
|
||||
|
||||
public void ToggleFade()
|
||||
{
|
||||
if (targetImage == null) return;
|
||||
|
||||
float targetAlpha = isVisible ? 0f : 1f;
|
||||
if (running != null) StopCoroutine(running);
|
||||
running = StartCoroutine(FadeTo(targetAlpha));
|
||||
isVisible = !isVisible;
|
||||
}
|
||||
|
||||
IEnumerator FadeTo(float targetAlpha)
|
||||
{
|
||||
float start = targetImage.color.a;
|
||||
float t = 0f;
|
||||
|
||||
while (t < duration)
|
||||
{
|
||||
t += Time.deltaTime;
|
||||
float a = Mathf.Lerp(start, targetAlpha, Mathf.Clamp01(t / duration));
|
||||
var c = targetImage.color;
|
||||
c.a = a;
|
||||
targetImage.color = c;
|
||||
yield return null;
|
||||
}
|
||||
|
||||
var final = targetImage.color;
|
||||
final.a = targetAlpha;
|
||||
targetImage.color = final;
|
||||
running = null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user