private bool LayerIsInsideBlendArea()
        {
            insideBlendVls = new List <LightingVolume>();

            foreach (var vol in volumes.Where(v => !v.isGlobal))
            {
                Vector3 pos = transform.position;
                Vector3 outherClosestPoint = vol.outherCol.ClosestPoint(pos);
                Vector3 innerClosestPoint  = vol.innerCol.ClosestPoint(pos);
                float   outherMagnitude    = (outherClosestPoint - pos).magnitude;
                float   innerMagnitude     = (innerClosestPoint - pos).magnitude;

                if (outherMagnitude == 0 && innerMagnitude > 0)
                {
                    insideBlendVls.Add(vol);
                }
            }

            if (insideBlendVls.Count > 0)
            {
                currentBlendVolume = insideBlendVls.OrderBy(v => v.priority).Last();
            }

            return(insideBlendVls.Count > 0 ? true : false);
        }
        internal void Unregister(LightingVolume volume)
        {
            Debug.Log("<color=red>REMOVING</color> lighting volume of type: " + (volume.isGlobal ? "GLOBAL" : "BLEND"));
            volumes.Remove(volume);

            if (checkVolumes == null)
            {
                checkVolumes = StartCoroutine(CheckVolumes());
            }
        }
        internal void Register(LightingVolume volume)
        {
            Debug.Log("<color=green>ADDING</color> New volume of type: " + (volume.isGlobal ? "GLOBAL" : "BLEND"));
            volumes.Add(volume);

            if (checkVolumes == null)
            {
                checkVolumes = StartCoroutine(CheckVolumes());
            }
        }
        private bool LayerIsInsideVolume()
        {
            foreach (var vol in volumes.Where(v => !v.isGlobal))
            {
                Vector3 pos = transform.position;
                Vector3 innerClosestPoint = vol.innerCol.ClosestPoint(pos);

                if ((innerClosestPoint - pos).magnitude == 0)
                {
                    currentVolume = vol;
                    return(true);
                }
            }

            return(false);
        }
        public LightingVolume GetHighestPriorityVolume()
        {
            float          highestPriority = float.NegativeInfinity;
            LightingVolume output          = null;

            foreach (var volume in volumes)
            {
                if (volume.priority > highestPriority)
                {
                    highestPriority = volume.priority;
                    output          = volume;
                }
            }

            return(output);
        }
 private void SetLightingProfiles(LightingVolume volA, LightingVolume volB)
 {
     this.volA       = volA;
     this.volB       = volB;
     this.volB.blend = 0;
 }
 private void OnEnable()
 {
     lv      = (LightingVolume)target;
     bc      = lv.GetComponent <BoxCollider>();
     profile = serializedObject.FindProperty("profile");
 }
 internal void Unregister(LightingVolume volume)
 {
     volumes.Remove(volume);
     SetDirty();
 }
 internal void Register(LightingVolume volume)
 {
     volumes.Add(volume);
     SetDirty();
 }