FogVoid.cs 833 B

12345678910111213141516171819202122232425262728293031
  1. using UnityEngine;
  2. namespace VolumetricFogAndMist2 {
  3. [ExecuteInEditMode]
  4. public class FogVoid : MonoBehaviour {
  5. [Range(0, 1)] public float roundness = 0.5f;
  6. [Range(0, 1)] public float falloff = 0.5f;
  7. private void OnEnable() {
  8. FogVoidManager.RegisterFogVoid(this);
  9. }
  10. private void OnDisable() {
  11. FogVoidManager.UnregisterFogVoid(this);
  12. }
  13. void OnDrawGizmosSelected() {
  14. Gizmos.color = new Color(1, 1, 0, 0.75F);
  15. if (VolumetricFogManager.allowFogVoidRotation) {
  16. Gizmos.matrix = transform.localToWorldMatrix;
  17. Gizmos.DrawWireCube(Vector3.zero, Vector3.one);
  18. } else {
  19. Gizmos.DrawWireCube(transform.position, transform.lossyScale);
  20. }
  21. }
  22. }
  23. }