54 lines
1.3 KiB
C#
54 lines
1.3 KiB
C#
using UnityEngine;
|
|
|
|
namespace X.Rendering.Scene
|
|
{
|
|
[ExecuteAlways]
|
|
[DefaultExecutionOrder(200)]
|
|
public class CapsuleShadowAreaEffect : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
internal CapsuleShadowAreaSetting capsuleAOSetting = CapsuleShadowAreaSetting.GetDefault();
|
|
[SerializeField, HideInInspector]
|
|
internal Vector4[] capsuleLights;
|
|
[SerializeField, HideInInspector]
|
|
internal Bounds Bounds = new Bounds(Vector3.zero, Vector3.one);
|
|
|
|
#if UNITY_EDITOR
|
|
private void Awake()
|
|
{
|
|
if(Application.isPlaying)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if(Bounds == new Bounds(Vector3.zero, Vector3.one))
|
|
{
|
|
Bounds.center = transform.position + new Vector3(0, 2, 0);
|
|
}
|
|
|
|
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
|
|
}
|
|
}
|