diff --git a/Assets/_Project/Scripts/Client/Presentation/StagingAmbiance.cs b/Assets/_Project/Scripts/Client/Presentation/StagingAmbiance.cs new file mode 100644 index 000000000..d202c3173 --- /dev/null +++ b/Assets/_Project/Scripts/Client/Presentation/StagingAmbiance.cs @@ -0,0 +1,64 @@ +using UnityEngine; + +namespace ProjectM.Client +{ + /// + /// Dev-only ambiance animator for the ArtStaging scene. Play-mode; modulates LIGHTS only + /// (no material/asset writes) so nothing persists on Play exit. Self-wires by object name. + /// + [DisallowMultipleComponent] + public sealed class StagingAmbiance : MonoBehaviour + { + [Header("Caustics")] + public float causticsSpinDegPerSec = 4f; + + [Header("Warm beacon flicker")] + public float beaconFlickerAmount = 0.06f; + + [Header("Bioluminescent pulse")] + public float floraPulseAmount = 0.22f; + public float floraPulseSpeed = 1.4f; + + Transform _caustics; + Light _beacon; float _beaconBase; + Light[] _flora; float[] _floraBase; + + void Awake() + { + var c = GameObject.Find("CausticsSpot"); + if (c != null) _caustics = c.transform; + + var b = GameObject.Find("WarmPool"); + if (b != null) { _beacon = b.GetComponent(); if (_beacon != null) _beaconBase = _beacon.intensity; } + + var fl = GameObject.Find("FloraLights"); + if (fl != null) + { + _flora = fl.GetComponentsInChildren(); + _floraBase = new float[_flora.Length]; + for (int i = 0; i < _flora.Length; i++) _floraBase[i] = _flora[i].intensity; + } + } + + void Update() + { + float t = Time.time; + + if (_caustics != null) + _caustics.Rotate(0f, causticsSpinDegPerSec * Time.deltaTime, 0f, Space.World); + + if (_beacon != null) + _beacon.intensity = _beaconBase * (1f + + beaconFlickerAmount * Mathf.Sin(t * 7.3f) + + beaconFlickerAmount * 0.5f * Mathf.Sin(t * 17.1f)); + + if (_flora != null) + for (int i = 0; i < _flora.Length; i++) + { + float phase = i * 1.7f; + _flora[i].intensity = _floraBase[i] + * (1f + floraPulseAmount * Mathf.Sin(t * floraPulseSpeed + phase)); + } + } + } +} diff --git a/Assets/_Project/Scripts/Client/Presentation/StagingAmbiance.cs.meta b/Assets/_Project/Scripts/Client/Presentation/StagingAmbiance.cs.meta new file mode 100644 index 000000000..96d178a19 --- /dev/null +++ b/Assets/_Project/Scripts/Client/Presentation/StagingAmbiance.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: abe491d4d98103f4ab08712d8a78a1eb \ No newline at end of file