| | 1 | | using DCL.SettingsCommon.SettingsControllers.BaseControllers; |
| | 2 | | using UnityEngine; |
| | 3 | |
|
| | 4 | | namespace DCL.SettingsCommon.SettingsControllers.SpecificControllers |
| | 5 | | { |
| | 6 | | [CreateAssetMenu(menuName = "Settings/Controllers/Controls/SoftShadows", fileName = "SoftShadowsControlController")] |
| | 7 | | public class SoftShadowsControlController : ToggleSettingsControlController |
| | 8 | | { |
| | 9 | | public override object GetStoredValue() => |
| 2 | 10 | | currentQualitySetting.softShadows; |
| | 11 | |
|
| | 12 | | public override void UpdateSetting(object newValue) |
| | 13 | | { |
| 2 | 14 | | currentQualitySetting.softShadows = (bool)newValue; |
| | 15 | |
|
| 2 | 16 | | if (SceneReferences.i.environmentLight) |
| | 17 | | { |
| 1 | 18 | | LightShadows shadowType = LightShadows.None; |
| | 19 | |
|
| 1 | 20 | | if (currentQualitySetting.shadows) |
| 1 | 21 | | shadowType = currentQualitySetting.softShadows ? LightShadows.Soft : LightShadows.Hard; |
| | 22 | |
|
| 1 | 23 | | SceneReferences.i.environmentLight.shadows = shadowType; |
| | 24 | | } |
| | 25 | | else |
| 1 | 26 | | Debug.LogWarning("Cannot set shadow mode to current light, SceneReferences.i.environmentLight is null"); |
| 1 | 27 | | } |
| | 28 | | } |
| | 29 | | } |