- 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
65 lines
1.7 KiB
C#
65 lines
1.7 KiB
C#
using System.Collections;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
namespace ProceduralEditor
|
|
{
|
|
public class SceneTransitionController : MonoBehaviour
|
|
{
|
|
const string GameplaySceneName = "Landscape";
|
|
|
|
[Header("Fade")]
|
|
[Tooltip("CanvasGroup on the Fade Image object.")]
|
|
[SerializeField] private CanvasGroup fadeGroup;
|
|
|
|
[Min(0f)]
|
|
[SerializeField] private float fadeDuration = 0.75f;
|
|
|
|
private bool transitionInProgress;
|
|
|
|
public void LoadGameplayScene()
|
|
{
|
|
if (transitionInProgress)
|
|
return;
|
|
|
|
if (fadeGroup == null)
|
|
{
|
|
Debug.LogError($"{nameof(SceneTransitionController)}: Fade Group is not assigned.");
|
|
|
|
return;
|
|
}
|
|
|
|
transitionInProgress = true;
|
|
StartCoroutine(FadeThenLoadGameplayScene());
|
|
}
|
|
|
|
private IEnumerator FadeThenLoadGameplayScene()
|
|
{
|
|
fadeGroup.gameObject.SetActive(true);
|
|
fadeGroup.blocksRaycasts = true;
|
|
fadeGroup.interactable = true;
|
|
|
|
float startingAlpha = fadeGroup.alpha;
|
|
float elapsed = 0f;
|
|
|
|
while (elapsed < fadeDuration)
|
|
{
|
|
elapsed += Time.unscaledDeltaTime;
|
|
|
|
float normalizedTime = Mathf.Clamp01(elapsed / fadeDuration);
|
|
|
|
fadeGroup.alpha = Mathf.Lerp(startingAlpha, 1f, normalizedTime);
|
|
|
|
yield return null;
|
|
}
|
|
|
|
fadeGroup.alpha = 1f;
|
|
|
|
yield return null;
|
|
|
|
Debug.Log($"Loading scene: {GameplaySceneName}");
|
|
|
|
SceneManager.LoadScene(GameplaySceneName);
|
|
}
|
|
}
|
|
} |