2025-09-11 20:42:09 +08:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace X.Rendering.Scene
|
|
|
|
|
{
|
|
|
|
|
[ExecuteAlways]
|
|
|
|
|
[DefaultExecutionOrder(200)]
|
|
|
|
|
public class CapsuleShadowAreaEffect : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
[SerializeField]
|
|
|
|
|
internal CapsuleShadowAreaSetting capsuleAOSetting = CapsuleShadowAreaSetting.GetDefault();
|
|
|
|
|
[SerializeField, HideInInspector]
|
2025-09-28 19:40:35 +08:00
|
|
|
internal LightData[] capsuleLights;
|
2025-09-25 19:05:14 +08:00
|
|
|
[SerializeField, HideInInspector]
|
|
|
|
|
internal Bounds Bounds = new Bounds(Vector3.zero, Vector3.one);
|
2025-09-11 20:42:09 +08:00
|
|
|
|
|
|
|
|
#if UNITY_EDITOR
|
|
|
|
|
private void Awake()
|
|
|
|
|
{
|
|
|
|
|
if(Application.isPlaying)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-25 19:05:14 +08:00
|
|
|
if(Bounds == new Bounds(Vector3.zero, Vector3.one))
|
|
|
|
|
{
|
|
|
|
|
Bounds.center = transform.position + new Vector3(0, 2, 0);
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-11 20:42:09 +08:00
|
|
|
SceneEffect.Instance.AddSceneAreaEffect(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnDestroy()
|
|
|
|
|
{
|
|
|
|
|
if (Application.isPlaying)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SceneEffect.Instance.RmSceneAreaEffect(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnValidate()
|
|
|
|
|
{
|
|
|
|
|
if (Application.isPlaying)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SceneEffect.Instance.AreaEffectValidate();
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|