| | 1 | | using DCL.SettingsCommon.SettingsControllers.BaseControllers; |
| | 2 | | using UnityEngine; |
| | 3 | |
|
| | 4 | | namespace DCL.SettingsCommon.SettingsControllers.SpecificControllers |
| | 5 | | { |
| | 6 | | [CreateAssetMenu(menuName = "Settings/Controllers/Controls/Shadow", fileName = "ShadowControlController")] |
| | 7 | | public class ShadowControlController : ToggleSettingsControlController |
| | 8 | | { |
| | 9 | | public override object GetStoredValue() => |
| 2 | 10 | | currentQualitySetting.shadows; |
| | 11 | |
|
| | 12 | | public override void UpdateSetting(object newValue) |
| | 13 | | { |
| 2 | 14 | | currentQualitySetting.shadows = (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.shadows ? 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"); |
| | 27 | |
|
| 2 | 28 | | CommonSettingsScriptableObjects.shadowsDisabled.Set(!currentQualitySetting.shadows); |
| 2 | 29 | | } |
| | 30 | | } |
| | 31 | | } |