2025-07-22 15:39:27 +08:00

42 lines
1.1 KiB
C#

using System;
using UnityEngine;
namespace X.Rendering.Feature
{
[RequireComponent(typeof(Collider)), ExecuteAlways]
public class FakeShadowLightConfig : MonoBehaviour
{
[Serializable]
class LightConfig
{
public float lightRange = 1;
public Transform position;
}
[HideInInspector]
public Vector4[] lightData = new Vector4[4];
[SerializeField, Tooltip("Max Size 4")]
private LightConfig[] lightCfg = new LightConfig[4];
void Start()
{
for (int i = 0; i < lightCfg.Length && i < 4; i++)
{
var cfg = lightCfg[i];
lightData[i] = new(cfg.position.position.x, cfg.position.position.y, cfg.position.position.z, cfg.lightRange);
}
}
#if UNITY_EDITOR
private void Update()
{
for (int i = 0; i < lightCfg.Length && i < 4; i++)
{
var cfg = lightCfg[i];
lightData[i] = new(cfg.position.position.x, cfg.position.position.y, cfg.position.position.z, cfg.lightRange);
}
}
#endif
}
}