Client: StagingAmbiance dev component (ArtStaging Play-mode juice)

Light-only ambiance animator (caustics spin, beacon flicker, bioluminescent
pulse); self-wires by name; no material writes so nothing persists on Play exit.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-14 21:31:59 -07:00
parent 011037e70c
commit 3103214e76
2 changed files with 66 additions and 0 deletions
@@ -0,0 +1,64 @@
using UnityEngine;
namespace ProjectM.Client
{
/// <summary>
/// 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.
/// </summary>
[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<Light>(); if (_beacon != null) _beaconBase = _beacon.intensity; }
var fl = GameObject.Find("FloraLights");
if (fl != null)
{
_flora = fl.GetComponentsInChildren<Light>();
_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));
}
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: abe491d4d98103f4ab08712d8a78a1eb