diff options
author | chai <chaifix@163.com> | 2021-10-01 10:04:00 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-10-01 10:04:00 +0800 |
commit | f0ae9393da021fe16af32f7ae1a3245f27050f92 (patch) | |
tree | eb3618a8661c6771098cdfe796bdff50b4e75328 /Assets/Scripts/Rendering/CustomLight.cs | |
parent | 5b19af7f51ad4504fc426b8387442f6b868b5f61 (diff) |
*misc
Diffstat (limited to 'Assets/Scripts/Rendering/CustomLight.cs')
-rw-r--r-- | Assets/Scripts/Rendering/CustomLight.cs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Assets/Scripts/Rendering/CustomLight.cs b/Assets/Scripts/Rendering/CustomLight.cs new file mode 100644 index 00000000..404dee12 --- /dev/null +++ b/Assets/Scripts/Rendering/CustomLight.cs @@ -0,0 +1,46 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class CustomLight : MonoBehaviour +{ + // Start is called before the first frame update + void OnEnable() + { + CustomLightRegistry.Instance.Register(this); + } + + // Update is called once per frame + void OnDisable() + { + CustomLightRegistry.Instance.Unregister(this); + } +} + +public class CustomLightRegistry : Singleton<CustomLightRegistry> +{ + private List<CustomLight> m_Lights; + public List<CustomLight> lights + { + get + { + if (m_Lights == null) + m_Lights = new List<CustomLight>(); + return m_Lights; + } + } + + public void Register(CustomLight renderer) + { + if (!lights.Contains(renderer)) + { + lights.Add(renderer); + } + } + + public void Unregister(CustomLight renderer) + { + lights.Remove(renderer); + } + +}
\ No newline at end of file |