< Summary

Class:DCL.SettingsCommon.SettingsControllers.SpecificControllers.SoftShadowsControlController
Assembly:SettingsControllers
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/Settings/SettingsControllers/SpecificControllers/SoftShadowsControlController.cs
Covered lines:15
Uncovered lines:1
Coverable lines:16
Total lines:47
Line coverage:93.7% (15 of 16)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Initialize()0%2.022083.33%
GetStoredValue()0%110100%
UpdateSetting(...)0%770100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/Settings/SettingsControllers/SpecificControllers/SoftShadowsControlController.cs

#LineLine coverage
 1using System.Reflection;
 2using DCL.SettingsCommon.SettingsControllers.BaseControllers;
 3using UnityEngine;
 4using UnityEngine.Rendering;
 5using UnityEngine.Rendering.Universal;
 6
 7namespace DCL.SettingsCommon.SettingsControllers.SpecificControllers
 8{
 9    [CreateAssetMenu(menuName = "Settings/Controllers/Controls/SoftShadows", fileName = "SoftShadowsControlController")]
 10    public class SoftShadowsControlController : ToggleSettingsControlController
 11    {
 12        private UniversalRenderPipelineAsset lightweightRenderPipelineAsset = null;
 13        private FieldInfo lwrpaSoftShadowField = null;
 14
 15        public override void Initialize()
 16        {
 217            base.Initialize();
 18
 219            lightweightRenderPipelineAsset = GraphicsSettings.renderPipelineAsset as UniversalRenderPipelineAsset;
 20
 221            if (lightweightRenderPipelineAsset == null)
 022                return;
 23
 224            lwrpaSoftShadowField = lightweightRenderPipelineAsset.GetType().GetField("m_SoftShadowsSupported", BindingFl
 225        }
 26
 227        public override object GetStoredValue() { return currentQualitySetting.softShadows; }
 28
 29        public override void UpdateSetting(object newValue)
 30        {
 231            currentQualitySetting.softShadows = (bool)newValue;
 32
 233            if (lightweightRenderPipelineAsset != null)
 234                lwrpaSoftShadowField?.SetValue(lightweightRenderPipelineAsset, currentQualitySetting.softShadows);
 35
 236            if (SceneReferences.i.environmentLight)
 37            {
 138                LightShadows shadowType = LightShadows.None;
 39
 140                if (currentQualitySetting.shadows)
 141                    shadowType = currentQualitySetting.softShadows ? LightShadows.Soft : LightShadows.Hard;
 42
 143                SceneReferences.i.environmentLight.shadows = shadowType;
 44            }
 245        }
 46    }
 47}