public static LightPatch GeneratePatch(MRELight _old, UnityLight _new)
        {
            if (_old == null && _new != null)
            {
                return(new LightPatch(_new));
            }
            else if (_new == null)
            {
                return(null);
            }

            var patch = new LightPatch()
            {
                Enabled   = _new.enabled,
                Type      = UtilMethods.ConvertEnum <Core.Interfaces.LightType, UnityEngine.LightType>(_new.type),
                Color     = new ColorPatch(_new.color),
                Range     = _new.range,
                Intensity = _new.intensity,
                SpotAngle = _new.spotAngle
            };

            if (patch.IsPatched())
            {
                return(patch);
            }
            else
            {
                return(null);
            }
        }
 /// <inheritdoc />
 public void ApplyPatch(LightPatch patch)
 {
     _light.enabled   = _light.enabled.GetPatchApplied(Enabled.ApplyPatch(patch.Enabled));
     _light.type      = _light.type.GetPatchApplied(Type.ApplyPatch(patch.Type));
     _light.color     = _light.color.GetPatchApplied(Color.ApplyPatch(patch.Color));
     _light.range     = _light.range.GetPatchApplied(Range.ApplyPatch(patch.Range));
     _light.intensity = _light.intensity.GetPatchApplied(Intensity.ApplyPatch(patch.Intensity));
     if (patch.SpotAngle.HasValue)
     {
         _light.spotAngle = Mathf.Rad2Deg * patch.SpotAngle.Value;
     }
 }
 /// <inheritdoc />
 public void ApplyPatch(LightPatch patch)
 {
     _light.Visible     = _light.Visible.GetPatchApplied(Enabled.ApplyPatch(patch.Enabled));
     _light.LightColor  = _light.LightColor.GetPatchApplied(Color.ApplyPatch(patch.Color));
     _light.LightEnergy = _light.LightEnergy.GetPatchApplied(Intensity.ApplyPatch(patch.Intensity));
     if (_light is SpotLight spotLight)
     {
         if (patch.SpotAngle.HasValue)
         {
             spotLight.SpotAngle = Mathf.Rad2Deg(patch.SpotAngle.Value);
         }
         spotLight.SpotRange = spotLight.SpotRange.GetPatchApplied(Range.ApplyPatch(patch.Range));
     }
     else if (_light is OmniLight omniLight)
     {
         omniLight.OmniRange = omniLight.OmniRange.GetPatchApplied(Range.ApplyPatch(patch.Range));
     }
 }
 /// <inheritdoc />
 public void SynchronizeEngine(LightPatch patch)
 {
     ApplyPatch(patch);
 }