FogPointLight.cs 811 B

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using UnityEngine;
  3. namespace VolumetricFogAndMist2 {
  4. [ExecuteInEditMode]
  5. public class FogPointLight : MonoBehaviour {
  6. [NonSerialized] public Light pointLight;
  7. [Tooltip("Inscattering multiplier for this point light")]
  8. public float inscattering = 1f;
  9. [Tooltip("Intensity multiplier for this point light")]
  10. public float intensity = 1f;
  11. private void OnEnable() {
  12. pointLight = GetComponent<Light>();
  13. PointLightManager.RegisterPointLight(this);
  14. }
  15. private void OnDisable() {
  16. PointLightManager.UnregisterPointLight(this);
  17. }
  18. private void OnValidate() {
  19. inscattering = Mathf.Max(0, inscattering);
  20. intensity = Mathf.Max(0, intensity);
  21. }
  22. }
  23. }