Files
2026-03-04 10:03:45 +08:00

3456 lines
128 KiB
C#

using System;
using System.Collections.Generic;
using UnityEngine;
namespace Artngame.SKYMASTER
{
[ExecuteInEditMode]
public class SeasonalTerrainSKYMASTER : MonoBehaviour
{
[Tooltip("For use with curve based system")]
public float VFogDistance = 21f;
public bool DistanceFogOn;
public bool HeightFogOn = true;
public bool SkyFogOn;
public float fogDensity = 0.3f;
public float fogGradientDistance = 1f;
public bool UseFogCurves;
[SerializeField]
public AnimationCurve heightOffsetFogCurve = new AnimationCurve(new Keyframe(0f, 1f), new Keyframe(0.75f, 1f), new Keyframe(0.85f, 1f), new Keyframe(0.95f, 1f), new Keyframe(1f, 1f));
[SerializeField]
public AnimationCurve luminanceVFogCurve = new AnimationCurve(new Keyframe(0f, 0.5f), new Keyframe(0.75f, 0.5f), new Keyframe(0.85f, 0.5f), new Keyframe(0.9f, 0.5f), new Keyframe(1f, 0.5f));
[SerializeField]
public AnimationCurve lumFactorFogCurve = new AnimationCurve(new Keyframe(0f, 1f), new Keyframe(0.75f, 1f), new Keyframe(0.85f, 1f), new Keyframe(0.9f, 1f), new Keyframe(1f, 1f));
[SerializeField]
public AnimationCurve scatterFacFogCurve = new AnimationCurve(new Keyframe(0f, 1f), new Keyframe(0.75f, 1f), new Keyframe(0.85f, 1f), new Keyframe(0.9f, 1f), new Keyframe(1f, 1f));
[SerializeField]
public AnimationCurve turbidityFogCurve = new AnimationCurve(new Keyframe(0f, 1f), new Keyframe(0.75f, 1f), new Keyframe(0.85f, 1f), new Keyframe(0.9f, 1f), new Keyframe(1f, 1f));
[SerializeField]
public AnimationCurve turbFacFogCurve = new AnimationCurve(new Keyframe(0f, 1f), new Keyframe(0.75f, 1f), new Keyframe(0.85f, 1f), new Keyframe(0.9f, 1f), new Keyframe(1f, 1f));
[SerializeField]
public AnimationCurve horizonFogCurve = new AnimationCurve(new Keyframe(0f, 1f), new Keyframe(1f, 1f));
[SerializeField]
public AnimationCurve contrastFogCurve = new AnimationCurve(new Keyframe(0f, 1f), new Keyframe(0.75f, 1f), new Keyframe(0.85f, 1f), new Keyframe(0.9f, 1f), new Keyframe(1f, 1f));
public float VolumeFogSpeed = 1f;
public bool tagBasedTreeGrab;
public bool UseTranspVFog;
public float AddFogHeightOffset = 900f;
public float AddFogDensityOffset;
public float AddShaftsIntensityUnder;
public float AddShaftsSizeUnder;
public float ShaftBlurRadiusOffset;
public bool Lerp_gradient;
public bool FogHeightByTerrain;
public float FogheightOffset;
public float FogdensityOffset;
private float FogUnityOffset;
public List<GameObject> TreePefabs = new List<GameObject>();
public Color currentTerrainTreeCol = Color.white;
public bool AlwaysUpdateBillboards;
private Transform Cam_transf;
public List<GlobalFogSkyMaster> GradientHolders = new List<GlobalFogSkyMaster>();
public bool StereoMode;
private GlobalFogSkyMaster SkyFogL;
private SunShaftsSkyMaster SunShaftsL;
private GlobalFogSkyMaster SkyFogR;
private SunShaftsSkyMaster SunShaftsR;
public GameObject LeftCam;
public GameObject RightCam;
private GlobalTranspFogSkyMaster SkyFogLT;
private GlobalTranspFogSkyMaster SkyFogRT;
private GlobalTranspFogSkyMaster SkyFogTransp;
private GlobalFogSkyMaster SkyFog;
private SunShaftsSkyMaster SunShafts;
public bool ImageEffectFog;
public bool Use_both_fogs;
public bool ImageEffectShafts;
public int FogPreset;
public bool UpdateLeafMat;
public List<Material> LeafMats;
public Color Rays_day_color = new Color(0.9254902f, 0.19215687f, 4f / 51f, 1f);
public Color Rays_night_color = new Color(0.9254902f, 0.9254902f, 0.9254902f, 1f);
public float Shafts_intensity = 1.45f;
public float Moon_Shafts_intensity = 0.45f;
public bool Mesh_moon;
public bool Glow_moon;
public bool Glow_sun;
private GameObject[] SkyMaster_TREE_objects;
public Color TreeA_color = Color.white;
public Color Terrain_tint = Color.white;
public Color Grass_tint = Color.white;
public bool Enable_trasition;
public TerrainData tData;
public Material TerrainMat;
private Color Starting_grass_tint;
private Color Starting_terrain_tint;
public float Trans_speed_tree = 0.4f;
public float Trans_speed_terr = 1f;
public float Trans_speed_grass = 0.4f;
public float Trans_speed_sky = 0.4f;
public bool Mesh_Terrain;
public bool Foggy_Terrain;
public bool Fog_Sky_Update;
public Vector3 SUN_POS;
public SkyMasterManager SkyManager;
public float fog_depth = 0.29f;
public float reileigh = 1.3f;
public float mieCoefficient = 1f;
public float mieDirectionalG = 0.1f;
public float ExposureBias = 0.11f;
private const float n = 1.0003f;
private const float N = 2.545E+25f;
private const float pn = 0.035f;
public Vector3 lambda = new Vector3(6.8E-07f, 5.5E-07f, 4.5E-07f);
public Vector3 K = new Vector3(0.9f, 0.5f, 0.5f);
private int toggle_rot;
public float SmallRotFactor = 0.0001f;
private Material[] mats;
public void setVFogCurvesPresetA()
{
heightOffsetFogCurve = new AnimationCurve(new Keyframe(0f, 1f), new Keyframe(0.75f, 1f), new Keyframe(0.85f, 1f), new Keyframe(0.95f, 1f), new Keyframe(1f, 1f));
luminanceVFogCurve = new AnimationCurve(new Keyframe(0f, 1f), new Keyframe(0.75f, 1f), new Keyframe(0.85f, 1f), new Keyframe(0.9f, 1f), new Keyframe(1f, 1f));
lumFactorFogCurve = new AnimationCurve(new Keyframe(0f, 1f), new Keyframe(0.75f, 1f), new Keyframe(0.85f, 1f), new Keyframe(0.9f, 1f), new Keyframe(1f, 1f));
scatterFacFogCurve = new AnimationCurve(new Keyframe(0f, 1f), new Keyframe(0.75f, 1f), new Keyframe(0.85f, 1f), new Keyframe(0.9f, 1f), new Keyframe(1f, 1f));
turbidityFogCurve = new AnimationCurve(new Keyframe(0f, 1f), new Keyframe(0.75f, 1f), new Keyframe(0.85f, 1f), new Keyframe(0.9f, 1f), new Keyframe(1f, 1f));
turbFacFogCurve = new AnimationCurve(new Keyframe(0f, 1f), new Keyframe(0.75f, 1f), new Keyframe(0.85f, 1f), new Keyframe(0.9f, 1f), new Keyframe(1f, 1f));
horizonFogCurve = new AnimationCurve(new Keyframe(0f, 1f), new Keyframe(1f, 1f));
contrastFogCurve = new AnimationCurve(new Keyframe(0f, 1f), new Keyframe(0.75f, 1f), new Keyframe(0.85f, 1f), new Keyframe(0.9f, 1f), new Keyframe(1f, 1f));
AddFogHeightOffset = 0f;
fogDensity = 150f;
DistanceFogOn = false;
VFogDistance = 0f;
}
public void setVFogCurvesPresetC()
{
heightOffsetFogCurve = new AnimationCurve(new Keyframe(0f, 55f), new Keyframe(0.75f, 45f), new Keyframe(0.85f, 60f), new Keyframe(0.9f, 130f), new Keyframe(0.95f, 54f), new Keyframe(1f, 55f));
luminanceVFogCurve = new AnimationCurve(new Keyframe(0f, 2f), new Keyframe(0.75f, 2f), new Keyframe(0.85f, 9f), new Keyframe(0.9f, 2f), new Keyframe(1f, 2f));
lumFactorFogCurve = new AnimationCurve(new Keyframe(0f, 0.2f), new Keyframe(0.75f, 0.2f), new Keyframe(0.85f, -0.1f), new Keyframe(0.9f, 0.2f), new Keyframe(1f, 0.2f));
scatterFacFogCurve = new AnimationCurve(new Keyframe(0f, 12f), new Keyframe(0.75f, 20f), new Keyframe(0.85f, 50f), new Keyframe(0.9f, 20f), new Keyframe(1f, 12f));
turbidityFogCurve = new AnimationCurve(new Keyframe(0f, 12f), new Keyframe(0.75f, 1f), new Keyframe(0.85f, 108f), new Keyframe(0.9f, 5f), new Keyframe(1f, 12f));
turbFacFogCurve = new AnimationCurve(new Keyframe(0f, 12f), new Keyframe(0.75f, 12f), new Keyframe(0.85f, 58f), new Keyframe(0.9f, 4f), new Keyframe(1f, 2f));
horizonFogCurve = new AnimationCurve(new Keyframe(0f, 1f), new Keyframe(1f, 1f));
contrastFogCurve = new AnimationCurve(new Keyframe(0f, 6f), new Keyframe(0.75f, 1.5f), new Keyframe(0.85f, 1.45f), new Keyframe(0.9f, 1.5f), new Keyframe(1f, 6f));
AddFogHeightOffset = 0f;
fogDensity = 200f;
DistanceFogOn = false;
VFogDistance = 0f;
}
public void setVFogCurvesPresetD()
{
heightOffsetFogCurve = new AnimationCurve(new Keyframe(0f, 55f), new Keyframe(0.75f, 45f), new Keyframe(0.85f, 60f), new Keyframe(0.9f, 130f), new Keyframe(0.95f, 54f), new Keyframe(1f, 55f));
luminanceVFogCurve = new AnimationCurve(new Keyframe(0f, 2f), new Keyframe(0.75f, -0.6f), new Keyframe(0.85f, 9f), new Keyframe(0.9f, 2f), new Keyframe(1f, 2f));
lumFactorFogCurve = new AnimationCurve(new Keyframe(0f, 0.2f), new Keyframe(0.75f, 0.2f), new Keyframe(0.85f, -0.1f), new Keyframe(0.9f, 0.2f), new Keyframe(1f, 0.2f));
scatterFacFogCurve = new AnimationCurve(new Keyframe(0f, 12f), new Keyframe(0.75f, 20f), new Keyframe(0.85f, 50f), new Keyframe(0.9f, 20f), new Keyframe(1f, 12f));
turbidityFogCurve = new AnimationCurve(new Keyframe(0f, 12f), new Keyframe(0.75f, 1f), new Keyframe(0.85f, 108f), new Keyframe(0.9f, 3f), new Keyframe(1f, 12f));
turbFacFogCurve = new AnimationCurve(new Keyframe(0f, 12f), new Keyframe(0.75f, 12f), new Keyframe(0.85f, 58f), new Keyframe(0.9f, 3f), new Keyframe(1f, 2f));
horizonFogCurve = new AnimationCurve(new Keyframe(0f, 1f), new Keyframe(1f, 1f));
contrastFogCurve = new AnimationCurve(new Keyframe(0f, 6f), new Keyframe(0.75f, 5.5f), new Keyframe(0.85f, 3.45f), new Keyframe(0.9f, 2.5f), new Keyframe(1f, 6f));
AddFogHeightOffset = 40f;
fogDensity = 150f;
DistanceFogOn = false;
VFogDistance = 0f;
}
public void setVFogCurvesPresetB()
{
heightOffsetFogCurve = new AnimationCurve(new Keyframe(0f, 55f), new Keyframe(0.75f, 45f), new Keyframe(0.85f, 60f), new Keyframe(0.9f, 130f), new Keyframe(0.95f, 54f), new Keyframe(1f, 55f));
luminanceVFogCurve = new AnimationCurve(new Keyframe(0f, 2f), new Keyframe(0.75f, 2f), new Keyframe(0.85f, 9f), new Keyframe(0.9f, 2f), new Keyframe(1f, 2f));
lumFactorFogCurve = new AnimationCurve(new Keyframe(0f, 0.2f), new Keyframe(0.75f, 0.2f), new Keyframe(0.85f, -0.25f), new Keyframe(0.9f, 0.2f), new Keyframe(1f, 0.2f));
scatterFacFogCurve = new AnimationCurve(new Keyframe(0f, 12f), new Keyframe(0.75f, 20f), new Keyframe(0.85f, 50f), new Keyframe(0.9f, 20f), new Keyframe(1f, 12f));
turbidityFogCurve = new AnimationCurve(new Keyframe(0f, 12f), new Keyframe(0.75f, 20f), new Keyframe(0.85f, 108f), new Keyframe(0.9f, 20f), new Keyframe(1f, 12f));
turbFacFogCurve = new AnimationCurve(new Keyframe(0f, 12f), new Keyframe(0.75f, 12f), new Keyframe(0.85f, 58f), new Keyframe(0.9f, 12f), new Keyframe(1f, 2f));
horizonFogCurve = new AnimationCurve(new Keyframe(0f, 1f), new Keyframe(1f, 1f));
contrastFogCurve = new AnimationCurve(new Keyframe(0f, 6f), new Keyframe(0.75f, 1.5f), new Keyframe(0.85f, 1.45f), new Keyframe(0.9f, 1.5f), new Keyframe(1f, 6f));
AddFogHeightOffset = -100f;
fogDensity = 200f;
DistanceFogOn = false;
VFogDistance = 0f;
}
public void setVFogCurvesPresetE()
{
heightOffsetFogCurve = new AnimationCurve(new Keyframe(0f, 55f), new Keyframe(0.75f, 45f), new Keyframe(0.85f, 60f), new Keyframe(0.9f, 130f), new Keyframe(0.95f, 54f), new Keyframe(1f, 55f));
luminanceVFogCurve = new AnimationCurve(new Keyframe(0f, 2.3f), new Keyframe(0.75f, 2.3f), new Keyframe(0.85f, 2.3f), new Keyframe(0.9f, 2.3f), new Keyframe(1f, 2.3f));
lumFactorFogCurve = new AnimationCurve(new Keyframe(0f, 0.2f), new Keyframe(0.75f, 0.2f), new Keyframe(0.85f, 0.2f), new Keyframe(0.9f, 0.2f), new Keyframe(1f, 0.2f));
scatterFacFogCurve = new AnimationCurve(new Keyframe(0f, 2150f), new Keyframe(0.75f, 2150f), new Keyframe(0.85f, 2150f), new Keyframe(0.9f, 2150f), new Keyframe(1f, 2150f));
turbidityFogCurve = new AnimationCurve(new Keyframe(0f, 12f), new Keyframe(0.75f, 10f), new Keyframe(0.85f, 10f), new Keyframe(0.9f, 10f), new Keyframe(1f, 12f));
turbFacFogCurve = new AnimationCurve(new Keyframe(0f, 1300f), new Keyframe(0.75f, 1300f), new Keyframe(0.85f, 1300f), new Keyframe(0.9f, 1300f), new Keyframe(1f, 1300f));
horizonFogCurve = new AnimationCurve(new Keyframe(0f, 50f), new Keyframe(1f, 50f));
contrastFogCurve = new AnimationCurve(new Keyframe(0f, 1.4f), new Keyframe(0.75f, 1.5f), new Keyframe(0.85f, 1.45f), new Keyframe(0.9f, 1.5f), new Keyframe(1f, 1.4f));
AddFogHeightOffset = 0f;
fogDensity = 25f;
DistanceFogOn = false;
VFogDistance = 0f;
ExposureBias = 1.5f;
mieCoefficient = 0.9f;
mieDirectionalG = 0.92f;
reileigh = 1000f;
}
private void Start()
{
if (!Mesh_Terrain && Terrain.activeTerrain != null)
{
tData = Terrain.activeTerrain.terrainData;
Starting_grass_tint = tData.wavingGrassTint;
}
if (TerrainMat != null)
{
Starting_terrain_tint = TerrainMat.color;
}
if (Camera.main != null)
{
Cam_transf = Camera.main.transform;
}
RunPresets(SkyFog, SunShafts, 10f, Init: true);
if (SkyFogTransp != null)
{
RunPresetsT(SkyFogTransp, SunShafts, 10f, Init: true);
}
}
private void OnApplicationQuit()
{
if (!Mesh_Terrain && tData != null)
{
tData.wavingGrassTint = Starting_grass_tint;
}
if (TerrainMat != null)
{
TerrainMat.color = Starting_terrain_tint;
}
}
private void Update()
{
if (Application.isPlaying && Cam_transf == null)
{
Cam_transf = Camera.main.transform;
}
if (!AlwaysUpdateBillboards || !Application.isPlaying)
{
return;
}
if (toggle_rot == 1)
{
Cam_transf.Rotate(Vector3.up, SmallRotFactor);
}
if (currentTerrainTreeCol != TreeA_color)
{
if (toggle_rot == 0)
{
toggle_rot = 1;
}
}
else
{
toggle_rot = 0;
}
}
private void LateUpdate()
{
if (!Mesh_Terrain && !(tData != null) && Terrain.activeTerrain != null)
{
tData = Terrain.activeTerrain.terrainData;
}
if (SkyFogTransp == null && Camera.main != null)
{
SkyFogTransp = Camera.main.GetComponent<GlobalTranspFogSkyMaster>();
}
if (SkyFog == null && Camera.main != null)
{
SkyFog = Camera.main.GetComponent<GlobalFogSkyMaster>();
if (SkyFog == null && ImageEffectFog)
{
Debug.Log("Please enter the GlobalFogSkyMaster script in the camera to enable the volumetric fog. Ignore this message if in open prefab mode.");
}
}
else if (SkyFog != null)
{
if (SkyFog.Sun == null)
{
SkyFog.Sun = SkyManager.SunObj.transform;
}
if (SkyFog.SkyManager == null)
{
SkyFog.SkyManager = SkyManager;
}
}
if (SunShafts == null && Camera.main != null)
{
SunShafts = Camera.main.GetComponent<SunShaftsSkyMaster>();
if (SunShafts == null && ImageEffectShafts)
{
Debug.Log("Please enter the SunShaftsSkyMaster script in the camera to enable the Sun Shafts. Ignore this message if in open prefab mode.");
}
}
else if (SunShafts != null && SunShafts.sunTransform == null)
{
SunShafts.sunTransform = SkyManager.SunObj.transform;
}
if (StereoMode)
{
if ((SkyFog != null) & (LeftCam != null) & (RightCam != null))
{
if (SkyFogL == null)
{
SkyFogL = LeftCam.GetComponent(typeof(GlobalFogSkyMaster)) as GlobalFogSkyMaster;
if (SkyFogL == null)
{
LeftCam.AddComponent<GlobalFogSkyMaster>();
}
}
if (SkyFogR == null)
{
SkyFogR = RightCam.GetComponent(typeof(GlobalFogSkyMaster)) as GlobalFogSkyMaster;
if (SkyFogR == null)
{
RightCam.AddComponent<GlobalFogSkyMaster>();
}
}
if (SkyFogLT == null)
{
SkyFogLT = LeftCam.GetComponent(typeof(GlobalTranspFogSkyMaster)) as GlobalTranspFogSkyMaster;
if (SkyFogLT == null)
{
LeftCam.AddComponent<GlobalTranspFogSkyMaster>();
}
}
if (SkyFogRT == null)
{
SkyFogRT = RightCam.GetComponent(typeof(GlobalTranspFogSkyMaster)) as GlobalTranspFogSkyMaster;
if (SkyFogRT == null)
{
RightCam.AddComponent<GlobalTranspFogSkyMaster>();
}
}
if (SunShaftsL == null)
{
SunShaftsL = LeftCam.GetComponent(typeof(SunShaftsSkyMaster)) as SunShaftsSkyMaster;
if (SunShaftsL == null)
{
LeftCam.AddComponent<SunShaftsSkyMaster>();
}
}
if (SunShaftsR == null)
{
SunShaftsR = RightCam.GetComponent(typeof(SunShaftsSkyMaster)) as SunShaftsSkyMaster;
if (SunShaftsR == null)
{
RightCam.AddComponent<SunShaftsSkyMaster>();
}
}
if ((SkyFogL != null) & (SkyFogR != null) & (SunShaftsL != null) & (SunShaftsR != null))
{
float speed = 10f;
if (!Application.isPlaying)
{
speed = 10000f;
}
if (SkyFogTransp != null && ((SkyFogLT != null) & (SkyFogRT != null) & UseTranspVFog))
{
RunPresetsT(SkyFogLT, SunShaftsL, speed, Init: false);
RunPresetsT(SkyFogRT, SunShaftsR, speed, Init: false);
}
else
{
RunPresets(SkyFogL, SunShaftsL, speed, Init: false);
RunPresets(SkyFogR, SunShaftsR, speed, Init: false);
}
}
}
else
{
Debug.Log("Please enter the left/right cameras in the script parameters to use stereo mode");
}
}
else
{
float speed2 = 10f;
if (!Application.isPlaying)
{
speed2 = 10000f;
}
if ((SkyFogTransp != null) & UseTranspVFog)
{
RunPresetsT(SkyFogTransp, SunShafts, speed2, Init: false);
}
else
{
RunPresets(SkyFog, SunShafts, speed2, Init: false);
}
}
if (ImageEffectFog)
{
if (UseTranspVFog)
{
if (SkyFog != null)
{
SkyFog.enabled = false;
}
if (SkyFogTransp != null)
{
SkyFogTransp.enabled = true;
}
if ((SkyFogLT != null) & (SkyFogRT != null))
{
SkyFogLT.enabled = true;
SkyFogRT.enabled = true;
}
if ((SkyFogL != null) & (SkyFogR != null))
{
SkyFogL.enabled = false;
SkyFogR.enabled = false;
}
}
else
{
if (SkyFog != null)
{
SkyFog.enabled = true;
}
if (SkyFogTransp != null)
{
SkyFogTransp.enabled = false;
}
if ((SkyFogLT != null) & (SkyFogRT != null))
{
SkyFogLT.enabled = false;
SkyFogRT.enabled = false;
}
if ((SkyFogL != null) & (SkyFogR != null))
{
SkyFogL.enabled = true;
SkyFogR.enabled = true;
}
}
}
if (Enable_trasition)
{
if (currentTerrainTreeCol != TreeA_color)
{
currentTerrainTreeCol = Color.Lerp(currentTerrainTreeCol, TreeA_color, Trans_speed_tree * Time.deltaTime);
Shader.SetGlobalVector("_UnityTerrainTreeTintColorSM", currentTerrainTreeCol);
}
if (TreePefabs != null)
{
for (int i = 0; i < TreePefabs.Count; i++)
{
if (!(TreePefabs[i] != null))
{
continue;
}
mats = TreePefabs[i].GetComponent<Renderer>().sharedMaterials;
for (int j = 0; j < mats.Length; j++)
{
if ((mats[j].name.Contains("Leaf") || mats[j].name.Contains("leaf") || mats[j].name.Contains("Leaves") || mats[j].name.Contains("leaves")) && mats[j].HasProperty("_Color") && mats[j].color != TreeA_color)
{
Color color = mats[j].color;
mats[j].color = Color.Lerp(color, TreeA_color, Trans_speed_tree * Time.deltaTime);
}
}
}
}
if (tagBasedTreeGrab && SkyMaster_TREE_objects == null)
{
SkyMaster_TREE_objects = GameObject.FindGameObjectsWithTag("SkyMasterTree");
}
if (((SkyMaster_TREE_objects != null) & Application.isPlaying) && SkyMaster_TREE_objects.Length != 0)
{
for (int k = 0; k < SkyMaster_TREE_objects.Length; k++)
{
for (int l = 0; l < SkyMaster_TREE_objects[k].GetComponent<Renderer>().sharedMaterials.Length; l++)
{
if ((SkyMaster_TREE_objects[k].GetComponent<Renderer>().sharedMaterials[l].name.Contains("Leaf") | SkyMaster_TREE_objects[k].GetComponent<Renderer>().sharedMaterials[l].name.Contains("leaf") | SkyMaster_TREE_objects[k].GetComponent<Renderer>().sharedMaterials[l].name.Contains("Leaves") | SkyMaster_TREE_objects[k].GetComponent<Renderer>().sharedMaterials[l].name.Contains("leaves")) && SkyMaster_TREE_objects[k].GetComponent<Renderer>().sharedMaterials[l].color != TreeA_color)
{
Color color2 = SkyMaster_TREE_objects[k].GetComponent<Renderer>().sharedMaterials[l].color;
SkyMaster_TREE_objects[k].GetComponent<Renderer>().sharedMaterials[l].color = Color.Lerp(color2, TreeA_color, Trans_speed_tree * Time.deltaTime);
}
}
}
}
if (Application.isPlaying && UpdateLeafMat)
{
for (int m = 0; m < LeafMats.Count; m++)
{
if (LeafMats[m].color != TreeA_color)
{
Color color3 = LeafMats[m].color;
LeafMats[m].color = Color.Lerp(color3, TreeA_color, Trans_speed_tree * Time.deltaTime);
}
}
}
if (!Mesh_Terrain && tData != null && tData.wavingGrassTint != Grass_tint)
{
Color wavingGrassTint = tData.wavingGrassTint;
tData.wavingGrassTint = Color.Lerp(wavingGrassTint, Grass_tint, Trans_speed_grass * Time.deltaTime);
}
if (TerrainMat != null && TerrainMat.color != Terrain_tint)
{
if (Application.isPlaying)
{
Color color4 = TerrainMat.color;
TerrainMat.color = Color.Lerp(color4, Terrain_tint, Trans_speed_terr * Time.deltaTime);
}
else
{
TerrainMat.color = Terrain_tint;
}
}
}
if (Foggy_Terrain && TerrainMat != null && SkyManager != null)
{
if (Fog_Sky_Update)
{
reileigh = SkyManager.m_fRayleighScaleDepth;
reileigh = SkyManager.m_Kr;
mieCoefficient = SkyManager.m_Km;
TerrainMat.SetVector("sunPosition", -SkyManager.SunObj.transform.forward.normalized);
TerrainMat.SetVector("betaR", totalRayleigh(lambda) * reileigh);
TerrainMat.SetVector("betaM", totalMie(lambda, K, fog_depth) * mieCoefficient);
TerrainMat.SetFloat("fog_depth", fog_depth);
TerrainMat.SetFloat("mieCoefficient", mieCoefficient);
TerrainMat.SetFloat("mieDirectionalG", mieDirectionalG);
TerrainMat.SetFloat("ExposureBias", ExposureBias);
}
else
{
TerrainMat.SetVector("sunPosition", -SkyManager.SunObj.transform.forward.normalized);
TerrainMat.SetVector("betaR", totalRayleigh(lambda) * reileigh);
TerrainMat.SetVector("betaM", totalMie(lambda, K, fog_depth) * mieCoefficient);
TerrainMat.SetFloat("fog_depth", fog_depth);
TerrainMat.SetFloat("mieCoefficient", mieCoefficient);
TerrainMat.SetFloat("mieDirectionalG", mieDirectionalG);
TerrainMat.SetFloat("ExposureBias", ExposureBias);
}
}
}
private static Vector3 totalRayleigh(Vector3 lambda)
{
return new Vector3(8f * Mathf.Pow(MathF.PI, 3f) * Mathf.Pow(Mathf.Pow(1.0003f, 2f) - 1f, 2f) * 6.105f / (7.635E+25f * Mathf.Pow(lambda.x, 4f) * 5.755f), 8f * Mathf.Pow(MathF.PI, 3f) * Mathf.Pow(Mathf.Pow(1.0003f, 2f) - 1f, 2f) * 6.105f / (7.635E+25f * Mathf.Pow(lambda.y, 4f) * 5.755f), 8f * Mathf.Pow(MathF.PI, 3f) * Mathf.Pow(Mathf.Pow(1.0003f, 2f) - 1f, 2f) * 6.105f / (7.635E+25f * Mathf.Pow(lambda.z, 4f) * 5.755f));
}
private static Vector3 totalMie(Vector3 lambda, Vector3 K, float T)
{
float num = 0.2f * T * 1E-16f;
return new Vector3(0.434f * num * MathF.PI * Mathf.Pow(MathF.PI * 2f / lambda.x, 2f) * K.x, 0.434f * num * MathF.PI * Mathf.Pow(MathF.PI * 2f / lambda.y, 2f) * K.y, 0.434f * num * MathF.PI * Mathf.Pow(MathF.PI * 2f / lambda.z, 2f) * K.z);
}
private void RunPresets(GlobalFogSkyMaster SkyFog, SunShaftsSkyMaster SunShafts, float speed, bool Init)
{
if (!(SkyFog != null) || !ImageEffectFog)
{
return;
}
bool flag = (SkyManager.AutoSunPosition && SkyManager.Rot_Sun_X > 0f) | (!SkyManager.AutoSunPosition && ((SkyManager.Current_Time > 9f + SkyManager.Shift_dawn) & (SkyManager.Current_Time <= 21.9f + SkyManager.Shift_dawn)));
bool flag2 = (SkyManager.AutoSunPosition && SkyManager.Rot_Sun_X > 0f) | (!SkyManager.AutoSunPosition && ((SkyManager.Current_Time > 8f + SkyManager.Shift_dawn) & (SkyManager.Current_Time <= 21.5f + SkyManager.Shift_dawn)));
bool flag3 = (SkyManager.AutoSunPosition && SkyManager.Rot_Sun_X < 5f) | (!SkyManager.AutoSunPosition && SkyManager.Current_Time > 21.6f + SkyManager.Shift_dawn);
bool flag4 = (SkyManager.AutoSunPosition && SkyManager.Rot_Sun_X > 5f) | (!SkyManager.AutoSunPosition && SkyManager.Current_Time > 7.9f + SkyManager.Shift_dawn);
float num = VolumeFogSpeed * (SkyManager.SPEED / 200f);
if (FogPreset == 0)
{
SkyFog.distanceFog = false;
SkyFog.useRadialDistance = false;
SkyFog.heightFog = true;
SkyFog.height = 246.69f;
FogheightOffset = Mathf.Lerp(FogheightOffset, 0f + AddFogHeightOffset, Time.deltaTime * num);
FogdensityOffset = Mathf.Lerp(FogdensityOffset, 0f + AddFogDensityOffset + FogUnityOffset, Time.deltaTime * num);
if (SkyManager != null)
{
if (flag2)
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.005f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.005f + AddFogDensityOffset + FogUnityOffset;
}
}
else
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0025f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.0025f + AddFogDensityOffset + FogUnityOffset;
}
}
if (flag)
{
if (ImageEffectShafts)
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_day_color;
SunShafts.sunTransform = SkyManager.SunObj.transform;
SunShafts.useDepthTexture = false;
SunShafts.radialBlurIterations = 2;
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.86f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.maxRadius = Mathf.Lerp(SunShafts.maxRadius, 0.4f, 0.4f * Time.deltaTime);
if (Glow_sun)
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Add;
}
else
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Screen;
}
}
}
else if (ImageEffectShafts)
{
if (flag4)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.1f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Moon_Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_night_color;
SunShafts.sunTransform = SkyManager.MoonObj.transform;
SunShafts.useDepthTexture = true;
if (Mesh_moon)
{
SunShafts.radialBlurIterations = 3;
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.58f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.maxRadius = Mathf.Lerp(SunShafts.maxRadius, 0.2f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.radialBlurIterations = 2;
SunShafts.sunShaftBlurRadius = 5.86f + ShaftBlurRadiusOffset;
SunShafts.maxRadius = 0.4f;
}
if (Glow_moon)
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Add;
}
else
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Screen;
}
}
}
if (!Application.isPlaying || Init)
{
SkyFog.startDistance = 1f;
}
else
{
SkyFog.startDistance = Mathf.Lerp(SkyFog.startDistance, 1f, Time.deltaTime * speed);
}
if (!Application.isPlaying)
{
SkyFog.GradientBounds = new Vector2(0f, 15000f);
}
else
{
SkyFog.GradientBounds = new Vector2(0f, Mathf.Lerp(SkyFog.GradientBounds.y, 15000f, Time.deltaTime * Trans_speed_sky * speed));
}
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 3.3f, Time.deltaTime * Trans_speed_sky);
SkyFog.lumFac = 0.24f;
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 34.16f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = 51.6f;
SkyFog.HorizFac = 0.4f;
SkyFog.turbidity = 200f;
SkyFog.reileigh = 10f;
SkyFog.mieCoefficient = 0.054f;
SkyFog.mieDirectionalG = 0.913f;
SkyFog.bias = 0.42f;
SkyFog.contrast = 1.51f;
SkyFog.FogSky = false;
SkyFog.TintColor = new Vector3(68f, 155f, 345f);
SkyFog.ClearSkyFac = Mathf.Lerp(SkyFog.ClearSkyFac, 5f, Time.deltaTime * Trans_speed_sky);
}
if (FogPreset == 1)
{
SkyFog.distanceFog = true;
SkyFog.useRadialDistance = true;
SkyFog.heightFog = true;
SkyFog.height = 446.69f;
FogheightOffset = Mathf.Lerp(FogheightOffset, 0f + AddFogHeightOffset, Time.deltaTime * num);
FogdensityOffset = Mathf.Lerp(FogdensityOffset, 0f + AddFogDensityOffset + FogUnityOffset, Time.deltaTime * num);
if (SkyManager != null)
{
if (flag2)
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0585f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.0585f + AddFogDensityOffset + FogUnityOffset;
}
}
else
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0015f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.0015f + AddFogDensityOffset + FogUnityOffset;
}
}
if (flag)
{
if (ImageEffectShafts)
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_day_color;
SunShafts.sunTransform = SkyManager.SunObj.transform;
SunShafts.useDepthTexture = false;
}
}
else if (ImageEffectShafts)
{
if (flag4)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.1f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Moon_Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_night_color;
SunShafts.sunTransform = SkyManager.MoonObj.transform;
SunShafts.useDepthTexture = true;
}
}
if (!Application.isPlaying || Init)
{
SkyFog.startDistance = 1f;
}
else
{
SkyFog.startDistance = Mathf.Lerp(SkyFog.startDistance, 1f, Time.deltaTime * speed);
}
SkyFog.GradientBounds = new Vector2(0f, Mathf.Lerp(SkyFog.GradientBounds.y, 0f, Time.deltaTime * Trans_speed_sky * speed));
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 2.94f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.lumFac = 0.24f;
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 273f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = 3.7f;
SkyFog.HorizFac = 0.4f;
SkyFog.turbidity = 14111f;
SkyFog.reileigh = 411f;
SkyFog.mieCoefficient = 0.054f;
SkyFog.mieDirectionalG = 0.913f;
SkyFog.bias = 0.42f;
SkyFog.contrast = 1.51f;
SkyFog.FogSky = true;
SkyFog.TintColor = new Vector3(68f, 155f, 345f);
SkyFog.ClearSkyFac = Mathf.Lerp(SkyFog.ClearSkyFac, 1f, Time.deltaTime * Trans_speed_sky);
}
if (FogPreset == 2)
{
SkyFog.distanceFog = false;
SkyFog.useRadialDistance = false;
SkyFog.heightFog = true;
SkyFog.height = 2372.5f;
FogheightOffset = Mathf.Lerp(FogheightOffset, 0f + AddFogHeightOffset, Time.deltaTime * num);
FogdensityOffset = Mathf.Lerp(FogdensityOffset, 0f + AddFogDensityOffset + FogUnityOffset, Time.deltaTime * num);
if (SkyManager != null)
{
if (flag2)
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0195f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.0195f + AddFogDensityOffset + FogUnityOffset;
}
}
else
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0015f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.0015f + AddFogDensityOffset + FogUnityOffset;
}
}
if (flag)
{
if (ImageEffectShafts)
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_day_color;
SunShafts.sunTransform = SkyManager.SunObj.transform;
SunShafts.useDepthTexture = false;
SunShafts.radialBlurIterations = 2;
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.86f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.maxRadius = Mathf.Lerp(SunShafts.maxRadius, 0.4f, 0.4f * Time.deltaTime);
if (Glow_sun)
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Add;
}
else
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Screen;
}
}
}
else if (ImageEffectShafts)
{
if (flag4)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.1f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Moon_Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_night_color;
SunShafts.sunTransform = SkyManager.MoonObj.transform;
SunShafts.useDepthTexture = true;
if (Mesh_moon)
{
SunShafts.radialBlurIterations = 3;
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.58f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.maxRadius = Mathf.Lerp(SunShafts.maxRadius, 0.2f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.radialBlurIterations = 2;
SunShafts.sunShaftBlurRadius = 5.86f + ShaftBlurRadiusOffset;
SunShafts.maxRadius = 0.4f;
}
if (Glow_moon)
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Add;
}
else
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Screen;
}
}
}
if (!Application.isPlaying || Init)
{
SkyFog.startDistance = 1f;
}
else
{
SkyFog.startDistance = Mathf.Lerp(SkyFog.startDistance, 1f, Time.deltaTime * speed);
}
SkyFog.GradientBounds = new Vector2(0f, Mathf.Lerp(SkyFog.GradientBounds.y, 20900f, Time.deltaTime * Trans_speed_sky * speed));
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 2.64f, Time.deltaTime * Trans_speed_sky);
SkyFog.lumFac = 0.24f;
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 34.16f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = 3.7f;
SkyFog.HorizFac = 0.4f;
SkyFog.turbidity = 14111f;
SkyFog.reileigh = 411f;
SkyFog.mieCoefficient = 0.054f;
SkyFog.mieDirectionalG = 0.913f;
SkyFog.bias = 0.42f;
SkyFog.contrast = 1.51f;
SkyFog.FogSky = false;
SkyFog.TintColor = new Vector3(68f, 155f, 345f);
SkyFog.ClearSkyFac = Mathf.Lerp(SkyFog.ClearSkyFac, 5f, Time.deltaTime * Trans_speed_sky);
}
if (FogPreset == 3)
{
SkyFog.distanceFog = true;
SkyFog.useRadialDistance = true;
SkyFog.heightFog = true;
SkyFog.height = Mathf.Lerp(SkyFog.height, 550.69f, Time.deltaTime);
FogheightOffset = Mathf.Lerp(FogheightOffset, 0f + AddFogHeightOffset, Time.deltaTime * num);
FogdensityOffset = Mathf.Lerp(FogdensityOffset, 0f + AddFogDensityOffset + FogUnityOffset, Time.deltaTime * num);
if (SkyManager != null)
{
if (flag2)
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.49f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.49f + AddFogDensityOffset + FogUnityOffset;
}
}
else
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0015f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.0015f + AddFogDensityOffset + FogUnityOffset;
}
}
if (flag)
{
if (ImageEffectShafts)
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_day_color;
SunShafts.sunTransform = SkyManager.SunObj.transform;
SunShafts.useDepthTexture = false;
}
}
else if (ImageEffectShafts)
{
if (flag4)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.1f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Moon_Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_night_color;
SunShafts.sunTransform = SkyManager.MoonObj.transform;
SunShafts.useDepthTexture = true;
}
}
if (!Application.isPlaying || Init)
{
SkyFog.startDistance = 1f;
}
else
{
SkyFog.startDistance = Mathf.Lerp(SkyFog.startDistance, 1f, Time.deltaTime * speed);
}
SkyFog.GradientBounds = new Vector2(0f, Mathf.Lerp(SkyFog.GradientBounds.y, 500f, Time.deltaTime * Trans_speed_sky * speed));
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 3f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.lumFac = 0.24f;
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 34.16f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = 3.7f;
SkyFog.HorizFac = 0.4f;
SkyFog.turbidity = 14111f;
SkyFog.reileigh = 3.21f;
SkyFog.mieCoefficient = 0.15f;
SkyFog.mieDirectionalG = 0.913f;
SkyFog.bias = 0.42f;
SkyFog.contrast = 1.51f;
SkyFog.FogSky = true;
SkyFog.TintColor = new Vector3(68f, 155f, 345f);
SkyFog.ClearSkyFac = Mathf.Lerp(SkyFog.ClearSkyFac, 3.7638f, Time.deltaTime * Trans_speed_sky);
}
if (FogPreset == 4)
{
SkyFog.distanceFog = true;
SkyFog.useRadialDistance = true;
SkyFog.heightFog = true;
SkyFog.height = Mathf.Lerp(SkyFog.height, 917.69f, Time.deltaTime);
FogheightOffset = Mathf.Lerp(FogheightOffset, 0f + AddFogHeightOffset, Time.deltaTime * num);
FogdensityOffset = Mathf.Lerp(FogdensityOffset, 0f + AddFogDensityOffset + FogUnityOffset, Time.deltaTime * num);
if (SkyManager != null)
{
if (flag2)
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0065f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.0065f + AddFogDensityOffset + FogUnityOffset;
}
}
else
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0015f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.0015f + AddFogDensityOffset + FogUnityOffset;
}
}
if (flag)
{
if (ImageEffectShafts)
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_day_color;
SunShafts.sunTransform = SkyManager.SunObj.transform;
SunShafts.useDepthTexture = false;
}
}
else if (ImageEffectShafts)
{
if (flag4)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.1f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Moon_Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_night_color;
SunShafts.sunTransform = SkyManager.MoonObj.transform;
SunShafts.useDepthTexture = true;
}
}
if (!Application.isPlaying || Init)
{
SkyFog.startDistance = 1f;
}
else
{
SkyFog.startDistance = Mathf.Lerp(SkyFog.startDistance, 1f, Time.deltaTime * speed);
}
SkyFog.GradientBounds = new Vector2(0f, Mathf.Lerp(SkyFog.GradientBounds.y, 20900f, Time.deltaTime * Trans_speed_sky * speed));
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 4.2f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.lumFac = 0.24f;
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 34.16f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = 3.7f;
SkyFog.HorizFac = 0.4f;
SkyFog.turbidity = Mathf.Lerp(SkyFog.turbidity, 111f, Time.deltaTime);
SkyFog.reileigh = 411f;
SkyFog.mieCoefficient = 0.054f;
SkyFog.mieDirectionalG = 0.913f;
SkyFog.bias = 0.42f;
SkyFog.contrast = 1.05f;
SkyFog.FogSky = true;
SkyFog.TintColor = new Vector3(68f, 155f, 345f);
SkyFog.ClearSkyFac = Mathf.Lerp(SkyFog.ClearSkyFac, 4.5638f, Time.deltaTime * Trans_speed_sky);
}
if (FogPreset == 5)
{
SkyFog.distanceFog = true;
SkyFog.useRadialDistance = true;
SkyFog.heightFog = true;
SkyFog.height = 446.69f;
FogheightOffset = Mathf.Lerp(FogheightOffset, 0f + AddFogHeightOffset, Time.deltaTime * num);
FogdensityOffset = Mathf.Lerp(FogdensityOffset, 0f + AddFogDensityOffset + FogUnityOffset, Time.deltaTime * num);
if (SkyManager != null)
{
if (flag2)
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0185f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.0185f + AddFogDensityOffset + FogUnityOffset;
}
}
else
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0015f + FogdensityOffset, Time.deltaTime * 12f);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.0015f + AddFogDensityOffset + FogUnityOffset;
}
}
if (flag)
{
if (ImageEffectShafts)
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_day_color;
SunShafts.sunTransform = SkyManager.SunObj.transform;
SunShafts.useDepthTexture = false;
}
}
else if (ImageEffectShafts)
{
if (flag4)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.1f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Moon_Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_night_color;
SunShafts.sunTransform = SkyManager.MoonObj.transform;
SunShafts.useDepthTexture = true;
}
}
if (!Application.isPlaying || Init)
{
SkyFog.startDistance = 1f;
}
else
{
SkyFog.startDistance = Mathf.Lerp(SkyFog.startDistance, 1f, Time.deltaTime * speed);
}
SkyFog.GradientBounds = new Vector2(0f, Mathf.Lerp(SkyFog.GradientBounds.y, 1f, Time.deltaTime * Trans_speed_sky * speed));
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 2.7f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.lumFac = 0.24f;
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 273f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = 3.7f;
SkyFog.HorizFac = 0.4f;
SkyFog.turbidity = 14111f;
SkyFog.reileigh = 411f;
SkyFog.mieCoefficient = 0.054f;
SkyFog.mieDirectionalG = 0.913f;
SkyFog.bias = 0.42f;
SkyFog.contrast = 1.51f;
SkyFog.FogSky = false;
SkyFog.TintColor = new Vector3(68f, 155f, 345f);
SkyFog.ClearSkyFac = Mathf.Lerp(SkyFog.ClearSkyFac, 1f, Time.deltaTime * Trans_speed_sky);
}
if (FogPreset == 6)
{
SkyFog.distanceFog = true;
SkyFog.useRadialDistance = true;
SkyFog.heightFog = true;
SkyFog.height = 274.06f;
FogheightOffset = Mathf.Lerp(FogheightOffset, 0f + AddFogHeightOffset, Time.deltaTime * num);
FogdensityOffset = Mathf.Lerp(FogdensityOffset, 0f + AddFogDensityOffset + FogUnityOffset, Time.deltaTime * num);
if (SkyManager != null)
{
if (flag2)
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 3.99f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 3.99f + AddFogDensityOffset + FogUnityOffset;
}
}
else
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 3.99f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 3.99f + AddFogDensityOffset + FogUnityOffset;
}
}
if (flag)
{
if (ImageEffectShafts)
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_day_color;
SunShafts.sunTransform = SkyManager.SunObj.transform;
SunShafts.useDepthTexture = false;
SunShafts.radialBlurIterations = 2;
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.86f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.maxRadius = Mathf.Lerp(SunShafts.maxRadius, 0.4f, 0.4f * Time.deltaTime);
if (Glow_sun)
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Add;
}
else
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Screen;
}
}
}
else if (ImageEffectShafts)
{
if (flag4)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.1f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Moon_Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_night_color;
SunShafts.sunTransform = SkyManager.MoonObj.transform;
SunShafts.useDepthTexture = true;
if (Mesh_moon)
{
SunShafts.radialBlurIterations = 3;
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.58f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.maxRadius = Mathf.Lerp(SunShafts.maxRadius, 0.2f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.radialBlurIterations = 2;
SunShafts.sunShaftBlurRadius = 5.86f + ShaftBlurRadiusOffset;
SunShafts.maxRadius = 0.4f;
}
if (Glow_moon)
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Add;
}
else
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Screen;
}
}
}
if (!Application.isPlaying || Init)
{
SkyFog.startDistance = 1f;
}
else
{
SkyFog.startDistance = Mathf.Lerp(SkyFog.startDistance, 1f, Time.deltaTime * speed);
}
SkyFog.GradientBounds = new Vector2(0f, Mathf.Lerp(SkyFog.GradientBounds.y, 32900f, Time.deltaTime * Trans_speed_sky * speed));
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 1.9f, Time.deltaTime * Trans_speed_sky);
SkyFog.lumFac = 0.31f;
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 34.16f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = 0.06f;
SkyFog.HorizFac = 68.41f;
SkyFog.turbidity = 14111f;
SkyFog.reileigh = 474f;
SkyFog.mieCoefficient = 0.054f;
SkyFog.mieDirectionalG = 0.913f;
SkyFog.bias = 0.42f;
SkyFog.contrast = 0.67f;
SkyFog.FogSky = true;
SkyFog.TintColor = new Vector3(36f, 108f, 345f);
SkyFog.ClearSkyFac = Mathf.Lerp(SkyFog.ClearSkyFac, 2.95f, Time.deltaTime * Trans_speed_sky);
}
if (FogPreset == 7)
{
SkyFog.distanceFog = false;
SkyFog.useRadialDistance = true;
SkyFog.heightFog = true;
SkyFog.height = 546.69f;
FogheightOffset = Mathf.Lerp(FogheightOffset, 50f + AddFogHeightOffset, Time.deltaTime * num);
FogdensityOffset = Mathf.Lerp(FogdensityOffset, 0f + AddFogDensityOffset + FogUnityOffset, Time.deltaTime * num);
if (SkyManager != null)
{
if (flag2)
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0132f + FogdensityOffset, Time.deltaTime * num);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.0132f + AddFogDensityOffset + FogUnityOffset;
}
}
else
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0125f + FogdensityOffset, Time.deltaTime * num);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.0125f + AddFogDensityOffset + FogUnityOffset;
}
}
if (flag)
{
if (ImageEffectShafts)
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime * num);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Shafts_intensity, 0.4f * Time.deltaTime * num);
}
SunShafts.sunColor = Rays_day_color;
SunShafts.sunTransform = SkyManager.SunObj.transform;
SunShafts.useDepthTexture = false;
}
}
else if (ImageEffectShafts)
{
if (flag4)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.1f * Time.deltaTime * num);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Moon_Shafts_intensity, 0.4f * Time.deltaTime * num);
}
SunShafts.sunColor = Rays_night_color;
SunShafts.sunTransform = SkyManager.MoonObj.transform;
SunShafts.useDepthTexture = true;
}
}
if (!Application.isPlaying || Init)
{
SkyFog.startDistance = 1f;
}
else
{
SkyFog.startDistance = Mathf.Lerp(SkyFog.startDistance, 1f, Time.deltaTime * speed);
}
SkyFog.GradientBounds = new Vector2(0f, Mathf.Lerp(SkyFog.GradientBounds.y, 20900f, Time.deltaTime * Trans_speed_sky * speed));
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 0.6f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.lumFac = 0.24f;
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 34.16f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = 0.07f;
SkyFog.HorizFac = 0.4f;
SkyFog.turbidity = 14f;
SkyFog.reileigh = 411f;
SkyFog.mieCoefficient = 0.054f;
SkyFog.mieDirectionalG = 0.913f;
SkyFog.bias = 0.42f;
SkyFog.contrast = 2.51f;
SkyFog.FogSky = true;
SkyFog.TintColor = new Vector3(68f, 587.6f, 345f);
SkyFog.ClearSkyFac = Mathf.Lerp(SkyFog.ClearSkyFac, 4.5f, Time.deltaTime * Trans_speed_sky);
}
if ((FogPreset == 9) | (FogPreset == 10))
{
SkyFog.distanceFog = false;
SkyFog.useRadialDistance = false;
SkyFog.heightFog = true;
SkyFog.height = 27.69f;
FogheightOffset = Mathf.Lerp(FogheightOffset, 0f + AddFogHeightOffset, Time.deltaTime * num);
FogdensityOffset = Mathf.Lerp(FogdensityOffset, 0f + AddFogDensityOffset + FogUnityOffset, Time.deltaTime * num);
if (SkyManager != null)
{
if (flag2)
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.02f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.02f + AddFogDensityOffset + FogUnityOffset;
}
}
else
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.015f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.015f + AddFogDensityOffset + FogUnityOffset;
}
}
if (flag)
{
if (ImageEffectShafts)
{
if (FogPreset == 10)
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Shafts_intensity + AddShaftsIntensityUnder, 0.4f * Time.deltaTime);
}
SunShafts.radialBlurIterations = 2;
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.86f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.maxRadius = Mathf.Lerp(SunShafts.maxRadius, 0.4f + AddShaftsSizeUnder, 0.4f * Time.deltaTime);
if (Glow_sun)
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Add;
}
else
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Screen;
}
SunShafts.useDepthTexture = false;
}
else
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 1.1f + AddShaftsIntensityUnder, 0.4f * Time.deltaTime);
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.4f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.maxRadius = Mathf.Lerp(SunShafts.maxRadius, 1.52f + AddShaftsSizeUnder, 0.4f * Time.deltaTime);
}
SunShafts.radialBlurIterations = 2;
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Screen;
SunShafts.useDepthTexture = true;
}
SunShafts.sunColor = Rays_day_color;
SunShafts.sunTransform = SkyManager.SunObj.transform;
}
}
else if (ImageEffectShafts)
{
if (FogPreset == 10)
{
if (flag4)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.1f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Moon_Shafts_intensity + AddShaftsIntensityUnder, 0.4f * Time.deltaTime);
}
}
else if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 1.1f + AddShaftsIntensityUnder, 0.4f * Time.deltaTime);
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.4f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.maxRadius = Mathf.Lerp(SunShafts.maxRadius, 1.52f + AddShaftsSizeUnder, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_night_color;
SunShafts.sunTransform = SkyManager.MoonObj.transform;
SunShafts.useDepthTexture = true;
if (Mesh_moon)
{
SunShafts.radialBlurIterations = 3;
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.58f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.maxRadius = Mathf.Lerp(SunShafts.maxRadius, 0.2f + AddShaftsSizeUnder, 0.4f * Time.deltaTime);
}
else
{
SunShafts.radialBlurIterations = 2;
SunShafts.sunShaftBlurRadius = 5.86f + ShaftBlurRadiusOffset;
SunShafts.maxRadius = 0.4f + AddShaftsSizeUnder;
}
if (Glow_moon)
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Add;
}
else
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Screen;
}
}
}
if (!Application.isPlaying || Init)
{
SkyFog.startDistance = 1f;
}
else
{
SkyFog.startDistance = Mathf.Lerp(SkyFog.startDistance, 1f, Time.deltaTime * speed);
}
if (!Application.isPlaying)
{
SkyFog.GradientBounds = new Vector2(0f, 5000f);
}
else
{
SkyFog.GradientBounds = new Vector2(0f, Mathf.Lerp(SkyFog.GradientBounds.y, 5000f, Time.deltaTime * Trans_speed_sky * speed));
}
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 3.2f, Time.deltaTime * Trans_speed_sky);
SkyFog.lumFac = 0.97f;
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 34.16f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = 3.7f;
SkyFog.HorizFac = 0.4f;
SkyFog.turbidity = 14111f;
SkyFog.reileigh = 411f;
SkyFog.mieCoefficient = 0.054f;
SkyFog.mieDirectionalG = 0.913f;
SkyFog.bias = 0.42f;
SkyFog.contrast = 3.8f;
SkyFog.FogSky = true;
SkyFog.TintColor = new Vector3(88.88f, 555f, 145f);
SkyFog.ClearSkyFac = Mathf.Lerp(SkyFog.ClearSkyFac, 1f, Time.deltaTime * Trans_speed_sky);
}
if (FogPreset == 11)
{
SkyFog.distanceFog = true;
SkyFog.useRadialDistance = false;
SkyFog.heightFog = true;
FogheightOffset = Mathf.Lerp(FogheightOffset, 0f + AddFogHeightOffset, Time.deltaTime * num);
FogdensityOffset = Mathf.Lerp(FogdensityOffset, 0f + AddFogDensityOffset + FogUnityOffset, Time.deltaTime * num);
if (SkyManager != null)
{
if (flag2)
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.001f + FogdensityOffset, Time.deltaTime);
SkyFog.height = Mathf.Lerp(SkyFog.height, 1505.69f, Time.deltaTime * 0.1f);
if (!Application.isPlaying || Init)
{
SkyFog.heightDensity = 0.001f + AddFogDensityOffset + FogUnityOffset;
SkyFog.height = 1505.69f;
}
}
else
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.001f + FogdensityOffset, Time.deltaTime);
SkyFog.height = Mathf.Lerp(SkyFog.height, 15.69f, Time.deltaTime);
if (!Application.isPlaying || Init)
{
SkyFog.heightDensity = 0.001f + AddFogDensityOffset + FogUnityOffset;
SkyFog.height = 15.69f;
}
}
if (flag)
{
if (ImageEffectShafts)
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_day_color;
SunShafts.sunTransform = SkyManager.SunObj.transform;
SunShafts.useDepthTexture = true;
}
}
else if (ImageEffectShafts)
{
if (flag4)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.1f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Moon_Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_night_color;
SunShafts.sunTransform = SkyManager.MoonObj.transform;
SunShafts.useDepthTexture = true;
}
}
if (!Application.isPlaying || Init)
{
SkyFog.startDistance = 200f;
}
else
{
SkyFog.startDistance = Mathf.Lerp(SkyFog.startDistance, 200f, Time.deltaTime * speed);
}
SkyFog.GradientBounds = new Vector2(0f, Mathf.Lerp(SkyFog.GradientBounds.y, 1f, Time.deltaTime * Trans_speed_sky * speed));
if (!Application.isPlaying || Init)
{
SkyFog.GradientBounds = new Vector2(0f, 1f);
SkyFog.luminance = 4.2f;
SkyFog.ScatterFac = 34.16f;
SkyFog.turbidity = 111f;
SkyFog.ClearSkyFac = 4.8f;
}
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 4.2f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.lumFac = 0.14f;
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 34.16f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = 3.7f;
SkyFog.HorizFac = 0.4f;
SkyFog.turbidity = Mathf.Lerp(SkyFog.turbidity, 111f, Time.deltaTime);
SkyFog.reileigh = 411f;
SkyFog.mieCoefficient = 0.054f;
SkyFog.mieDirectionalG = 0.913f;
SkyFog.bias = 0.42f;
SkyFog.contrast = 2.05f;
SkyFog.FogSky = false;
SkyFog.TintColor = new Vector3(68f, 155f, 345f);
SkyFog.ClearSkyFac = Mathf.Lerp(SkyFog.ClearSkyFac, 4.8f, Time.deltaTime * Trans_speed_sky);
}
if (FogPreset == 12)
{
SkyFog.distanceFog = false;
SkyFog.useRadialDistance = false;
SkyFog.heightFog = true;
FogheightOffset = Mathf.Lerp(FogheightOffset, 0f + AddFogHeightOffset, Time.deltaTime * num);
FogdensityOffset = Mathf.Lerp(FogdensityOffset, 0f + AddFogDensityOffset + FogUnityOffset, Time.deltaTime * num);
if (SkyManager != null)
{
if (flag2)
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.031f + FogdensityOffset, Time.deltaTime);
SkyFog.height = Mathf.Lerp(SkyFog.height, 1505.69f, Time.deltaTime * 0.1f);
if (!Application.isPlaying || Init)
{
SkyFog.heightDensity = 0.031f + AddFogDensityOffset + FogUnityOffset;
SkyFog.height = 1505.69f;
}
}
else
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.001f + FogdensityOffset, Time.deltaTime);
SkyFog.height = Mathf.Lerp(SkyFog.height, 15.69f, Time.deltaTime);
if (!Application.isPlaying || Init)
{
SkyFog.heightDensity = 0.001f + AddFogDensityOffset + FogUnityOffset;
SkyFog.height = 15.69f;
}
}
if (flag)
{
if (ImageEffectShafts)
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.4f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.sunColor = Rays_day_color;
SunShafts.sunTransform = SkyManager.SunObj.transform;
SunShafts.useDepthTexture = true;
}
}
else if (ImageEffectShafts)
{
if (flag4)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.1f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Moon_Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.4f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.sunColor = Rays_night_color;
SunShafts.sunTransform = SkyManager.MoonObj.transform;
SunShafts.useDepthTexture = true;
}
}
if (!Application.isPlaying || Init)
{
SkyFog.startDistance = 200f;
}
else
{
SkyFog.startDistance = Mathf.Lerp(SkyFog.startDistance, 200f, Time.deltaTime * speed);
}
SkyFog.GradientBounds = new Vector2(0f, Mathf.Lerp(SkyFog.GradientBounds.y, 21111f, Time.deltaTime * Trans_speed_sky * speed));
if (!Application.isPlaying || Init)
{
SkyFog.GradientBounds = new Vector2(0f, 21111f);
SkyFog.luminance = 0.84f;
SkyFog.ScatterFac = 34.16f;
SkyFog.turbidity = 61.41f;
SkyFog.ClearSkyFac = 4.8f;
}
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 0.84f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.lumFac = 0.16f;
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 34.16f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = 5.4f;
SkyFog.HorizFac = 0.4f;
SkyFog.turbidity = Mathf.Lerp(SkyFog.turbidity, 61.41f, Time.deltaTime);
SkyFog.reileigh = 303.24f;
SkyFog.mieCoefficient = 0.074f;
SkyFog.mieDirectionalG = 0.88f;
SkyFog.bias = 0.62f;
SkyFog.contrast = 3.75f;
SkyFog.FogSky = true;
SkyFog.TintColor = new Vector3(35.8f, 155f, 345f);
SkyFog.ClearSkyFac = Mathf.Lerp(SkyFog.ClearSkyFac, 10.91f, Time.deltaTime * Trans_speed_sky);
}
if ((FogPreset == 13) | (FogPreset == 14))
{
SkyFog.distanceFog = false;
SkyFog.useRadialDistance = true;
SkyFog.heightFog = true;
FogheightOffset = Mathf.Lerp(FogheightOffset, 30f + AddFogHeightOffset, Time.deltaTime * num * 20f);
FogdensityOffset = Mathf.Lerp(FogdensityOffset, 0f + AddFogDensityOffset + FogUnityOffset, Time.deltaTime * num);
if (SkyManager != null)
{
if (flag2)
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.05f + FogdensityOffset, Time.deltaTime);
SkyFog.height = Mathf.Lerp(SkyFog.height, 1505.69f, Time.deltaTime * 0.1f);
if (!Application.isPlaying || Init)
{
SkyFog.heightDensity = 0.05f + AddFogDensityOffset + FogUnityOffset;
SkyFog.height = 1505.69f;
}
}
else
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.05f + FogdensityOffset, Time.deltaTime);
SkyFog.height = Mathf.Lerp(SkyFog.height, 15.69f, Time.deltaTime);
if (!Application.isPlaying || Init)
{
SkyFog.heightDensity = 0.05f + AddFogDensityOffset + FogUnityOffset;
SkyFog.height = 15.69f;
}
}
if (flag)
{
if (ImageEffectShafts)
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 0f, 0.4f * Time.deltaTime);
SunShafts.sunColor = Rays_day_color;
SunShafts.sunTransform = SkyManager.SunObj.transform;
SunShafts.useDepthTexture = true;
}
}
else if (ImageEffectShafts)
{
if (flag4)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.1f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 0f, 0.4f * Time.deltaTime);
SunShafts.sunColor = Rays_night_color;
SunShafts.sunTransform = SkyManager.MoonObj.transform;
SunShafts.useDepthTexture = true;
}
}
if (!Application.isPlaying || Init)
{
SkyFog.startDistance = 20f;
}
else
{
SkyFog.startDistance = Mathf.Lerp(SkyFog.startDistance, 20f, Time.deltaTime * speed);
}
SkyFog.GradientBounds = new Vector2(0f, Mathf.Lerp(SkyFog.GradientBounds.y, 1500f, Time.deltaTime * Trans_speed_sky * speed));
if (!Application.isPlaying || Init)
{
SkyFog.GradientBounds = new Vector2(0f, 1500f);
SkyFog.luminance = 0.9f;
SkyFog.ScatterFac = 24f;
SkyFog.turbidity = 61.41f;
SkyFog.ClearSkyFac = 2f;
}
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 0.9f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.lumFac = 0.7f;
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 24f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = 0.02f;
SkyFog.HorizFac = 0.4f;
SkyFog.turbidity = Mathf.Lerp(SkyFog.turbidity, 61.41f, Time.deltaTime);
SkyFog.reileigh = 303.24f;
SkyFog.mieCoefficient = 0.074f;
SkyFog.mieDirectionalG = 0.88f;
SkyFog.bias = 0.62f;
SkyFog.contrast = 3.45f;
SkyFog.FogSky = true;
SkyFog.TintColor = new Vector3(81.8f, 155f, 26f);
SkyFog.ClearSkyFac = Mathf.Lerp(SkyFog.ClearSkyFac, 2f, Time.deltaTime * Trans_speed_sky);
}
if (FogPreset == 15)
{
SkyFog.distanceFog = false;
SkyFog.useRadialDistance = false;
SkyFog.heightFog = true;
FogheightOffset = Mathf.Lerp(FogheightOffset, 113f + AddFogHeightOffset, Time.deltaTime * num * 20f);
FogdensityOffset = Mathf.Lerp(FogdensityOffset, 0f + AddFogDensityOffset + FogUnityOffset, Time.deltaTime * num);
if (SkyManager != null)
{
if (flag)
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0015f + FogdensityOffset, Time.deltaTime);
SkyFog.height = Mathf.Lerp(SkyFog.height, 155.69f, Time.deltaTime * 0.1f);
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 1.9f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.bias = Mathf.Lerp(SkyFog.bias, 1.66f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.contrast = Mathf.Lerp(SkyFog.contrast, 6.52f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.mieCoefficient = Mathf.Lerp(SkyFog.mieCoefficient, 0.13f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 180f, Time.deltaTime * Trans_speed_sky);
SkyFog.mieDirectionalG = Mathf.Lerp(SkyFog.mieDirectionalG, 0.93f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = Mathf.Lerp(SkyFog.TurbFac, 320f, Time.deltaTime * Trans_speed_sky);
SkyFog.HorizFac = Mathf.Lerp(SkyFog.HorizFac, 421f, Time.deltaTime * Trans_speed_sky);
SkyFog.lumFac = Mathf.Lerp(SkyFog.lumFac, 0.21f, Time.deltaTime * Trans_speed_sky);
SkyFog.turbidity = Mathf.Lerp(SkyFog.turbidity, 9.7f, Time.deltaTime * Trans_speed_sky);
SkyFog.reileigh = Mathf.Lerp(SkyFog.reileigh, 0.8f, Time.deltaTime * Trans_speed_sky);
if (!Application.isPlaying || Init)
{
SkyFog.heightDensity = 0.0015f + AddFogDensityOffset + FogUnityOffset;
SkyFog.height = 155.69f;
SkyFog.luminance = 1.9f;
SkyFog.bias = 1.66f;
SkyFog.contrast = 6.52f;
SkyFog.mieCoefficient = 0.13f;
SkyFog.ScatterFac = 180f;
SkyFog.mieDirectionalG = 0.93f;
SkyFog.TurbFac = 320f;
SkyFog.HorizFac = 421f;
SkyFog.lumFac = 0.21f;
SkyFog.turbidity = 9.7f;
SkyFog.reileigh = 0.8f;
}
SkyFog.Sun = SkyManager.SunObj.transform;
}
else
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0045f + FogdensityOffset, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.height = Mathf.Lerp(SkyFog.height, 155.69f, Time.deltaTime);
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 3.04f, Time.deltaTime * Trans_speed_sky * speed * 1f);
SkyFog.bias = Mathf.Lerp(SkyFog.bias, 1.3f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.mieCoefficient = Mathf.Lerp(SkyFog.mieCoefficient, 0.3f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 10f, Time.deltaTime * Trans_speed_sky * 1f);
SkyFog.mieDirectionalG = Mathf.Lerp(SkyFog.mieDirectionalG, 0.7f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = Mathf.Lerp(SkyFog.TurbFac, 2f, Time.deltaTime * Trans_speed_sky * 1f);
SkyFog.HorizFac = Mathf.Lerp(SkyFog.HorizFac, 10f, Time.deltaTime * Trans_speed_sky * 1f);
SkyFog.lumFac = Mathf.Lerp(SkyFog.lumFac, 0.4f, Time.deltaTime * Trans_speed_sky);
SkyFog.turbidity = Mathf.Lerp(SkyFog.turbidity, 0f, Time.deltaTime * Trans_speed_sky * speed * 4f);
SkyFog.reileigh = Mathf.Lerp(SkyFog.reileigh, 0.01f, Time.deltaTime * Trans_speed_sky);
if (!Application.isPlaying || Init)
{
SkyFog.heightDensity = 0.0045f + AddFogDensityOffset + FogUnityOffset;
SkyFog.height = 155.69f;
SkyFog.luminance = 3.04f;
SkyFog.bias = 1.3f;
SkyFog.contrast = 1f;
SkyFog.mieCoefficient = 0.3f;
SkyFog.ScatterFac = 10f;
SkyFog.mieDirectionalG = 0.7f;
SkyFog.TurbFac = 2f;
SkyFog.HorizFac = 10f;
SkyFog.lumFac = 0.4f;
SkyFog.turbidity = 0f;
SkyFog.reileigh = 0.01f;
}
if (SkyManager.Rot_Sun_X < -11f)
{
SkyFog.Sun = SkyManager.MoonObj.transform;
SkyFog.contrast = Mathf.Lerp(SkyFog.contrast, 0.7f, Time.deltaTime * Trans_speed_sky * speed * 0.2f);
}
else
{
SkyFog.Sun = SkyManager.SunObj.transform;
SkyFog.contrast = Mathf.Lerp(SkyFog.contrast, 2.5f, Time.deltaTime * Trans_speed_sky * speed * 0.1f);
}
}
if (flag)
{
if (ImageEffectShafts)
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.4f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.sunColor = Rays_day_color;
SunShafts.sunTransform = SkyManager.SunObj.transform;
SunShafts.useDepthTexture = true;
}
}
else if (ImageEffectShafts)
{
if (flag4)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.1f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Moon_Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.4f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.sunColor = Rays_night_color;
SunShafts.sunTransform = SkyManager.MoonObj.transform;
SunShafts.useDepthTexture = true;
}
}
if (!Application.isPlaying || Init)
{
SkyFog.startDistance = 20f;
}
else
{
SkyFog.startDistance = Mathf.Lerp(SkyFog.startDistance, 20f, Time.deltaTime * speed);
}
SkyFog.GradientBounds = new Vector2(0f, Mathf.Lerp(SkyFog.GradientBounds.y, 2000f, Time.deltaTime * Trans_speed_sky * speed));
if (!Application.isPlaying || Init)
{
SkyFog.GradientBounds = new Vector2(0f, 1000f);
SkyFog.turbidity = 9.7f;
SkyFog.ClearSkyFac = 2f;
}
SkyFog.FogSky = true;
SkyFog.TintColor = new Vector3(65.4f, 155f, 345f);
SkyFog.ClearSkyFac = Mathf.Lerp(SkyFog.ClearSkyFac, 6.25f, Time.deltaTime * Trans_speed_sky);
}
if (GradientHolders.Count > 0 && FogPreset < GradientHolders.Count && GradientHolders[FogPreset] != null && GradientHolders[FogPreset].DistGradient != SkyFog.DistGradient)
{
if (Lerp_gradient)
{
if (Mathf.Abs(SkyFog.DistGradient.colorKeys.Length - GradientHolders[FogPreset].DistGradient.colorKeys.Length) == 0)
{
GradientColorKey[] array = new GradientColorKey[8];
for (int i = 0; i < GradientHolders[FogPreset].DistGradient.colorKeys.Length; i++)
{
array[i] = new GradientColorKey(Color.Lerp(SkyFog.DistGradient.colorKeys[i].color, GradientHolders[FogPreset].DistGradient.colorKeys[i].color, Time.deltaTime * 1.4f), Mathf.Lerp(SkyFog.DistGradient.colorKeys[i].time, GradientHolders[FogPreset].DistGradient.colorKeys[i].time, Time.deltaTime * 0.4f));
}
SkyFog.DistGradient.SetKeys(array, SkyFog.DistGradient.alphaKeys);
}
else
{
SkyFog.DistGradient.SetKeys(GradientHolders[FogPreset].DistGradient.colorKeys, GradientHolders[FogPreset].DistGradient.alphaKeys);
}
}
else
{
SkyFog.DistGradient.SetKeys(GradientHolders[FogPreset].DistGradient.colorKeys, GradientHolders[FogPreset].DistGradient.alphaKeys);
}
}
if (SkyManager != null && !Use_both_fogs)
{
if ((SkyManager.Weather == SkyMasterManager.Weather_types.Foggy) | (SkyManager.Weather == SkyMasterManager.Weather_types.HeavyFog) | (SkyManager.Season == 4))
{
SkyManager.Use_fog = false;
RenderSettings.fog = false;
RenderSettings.fogDensity = 0.0005f;
FogPreset = 1;
}
else
{
RenderSettings.fogDensity = 5E-05f;
}
}
if (UseFogCurves)
{
float calcColorTime = SkyManager.calcColorTime;
FogheightOffset = heightOffsetFogCurve.Evaluate(calcColorTime) + AddFogHeightOffset;
if (!FogHeightByTerrain)
{
SkyFog.height = FogheightOffset;
}
SkyFog.FogSky = SkyFogOn;
SkyFog.heightFog = HeightFogOn;
SkyFog.distanceFog = DistanceFogOn;
SkyFog.startDistance = VFogDistance;
SkyFog.GradientBounds.y = fogGradientDistance;
SkyFog.heightDensity = fogDensity * 0.0001f;
SkyFog.luminance = luminanceVFogCurve.Evaluate(calcColorTime);
SkyFog.lumFac = lumFactorFogCurve.Evaluate(calcColorTime);
SkyFog.ScatterFac = scatterFacFogCurve.Evaluate(calcColorTime);
SkyFog.turbidity = turbidityFogCurve.Evaluate(calcColorTime);
SkyFog.TurbFac = turbFacFogCurve.Evaluate(calcColorTime);
SkyFog.HorizFac = horizonFogCurve.Evaluate(calcColorTime);
SkyFog.contrast = contrastFogCurve.Evaluate(calcColorTime);
SkyFog.reileigh = 1000f;
SkyFog.mieCoefficient = 0.9f;
SkyFog.mieDirectionalG = 0.92f;
SkyFog.bias = 1.5f;
}
if (FogHeightByTerrain)
{
if (Mesh_Terrain)
{
SkyFog.height = base.transform.position.y + 25f + FogheightOffset;
}
if (Terrain.activeTerrain != null)
{
SkyFog.height = base.transform.position.y + 25f + FogheightOffset;
}
}
}
private void RunPresetsT(GlobalTranspFogSkyMaster SkyFog, SunShaftsSkyMaster SunShafts, float speed, bool Init)
{
if (!(SkyFog != null) || !ImageEffectFog)
{
return;
}
bool flag = (SkyManager.AutoSunPosition && SkyManager.Rot_Sun_X > 0f) | (!SkyManager.AutoSunPosition && ((SkyManager.Current_Time > 9f + SkyManager.Shift_dawn) & (SkyManager.Current_Time <= 21.9f + SkyManager.Shift_dawn)));
bool flag2 = (SkyManager.AutoSunPosition && SkyManager.Rot_Sun_X > 0f) | (!SkyManager.AutoSunPosition && ((SkyManager.Current_Time > 8f + SkyManager.Shift_dawn) & (SkyManager.Current_Time <= 21.5f + SkyManager.Shift_dawn)));
bool flag3 = (SkyManager.AutoSunPosition && SkyManager.Rot_Sun_X < 5f) | (!SkyManager.AutoSunPosition && SkyManager.Current_Time > 21.6f + SkyManager.Shift_dawn);
bool flag4 = (SkyManager.AutoSunPosition && SkyManager.Rot_Sun_X > 5f) | (!SkyManager.AutoSunPosition && SkyManager.Current_Time > 7.9f + SkyManager.Shift_dawn);
float num = VolumeFogSpeed * (SkyManager.SPEED / 200f);
if (FogPreset == 0)
{
SkyFog.distanceFog = false;
SkyFog.useRadialDistance = false;
SkyFog.heightFog = true;
SkyFog.height = 246.69f;
FogheightOffset = Mathf.Lerp(FogheightOffset, 0f + AddFogHeightOffset, Time.deltaTime * num);
FogdensityOffset = Mathf.Lerp(FogdensityOffset, 0f + AddFogDensityOffset + FogUnityOffset, Time.deltaTime * num);
if (SkyManager != null)
{
if (flag2)
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.005f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.005f + AddFogDensityOffset + FogUnityOffset;
}
}
else
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0025f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.0025f + AddFogDensityOffset + FogUnityOffset;
}
}
if (flag)
{
if (ImageEffectShafts)
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_day_color;
SunShafts.sunTransform = SkyManager.SunObj.transform;
SunShafts.useDepthTexture = false;
SunShafts.radialBlurIterations = 2;
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.86f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.maxRadius = Mathf.Lerp(SunShafts.maxRadius, 0.4f, 0.4f * Time.deltaTime);
if (Glow_sun)
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Add;
}
else
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Screen;
}
}
}
else if (ImageEffectShafts)
{
if (flag4)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.1f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Moon_Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_night_color;
SunShafts.sunTransform = SkyManager.MoonObj.transform;
SunShafts.useDepthTexture = true;
if (Mesh_moon)
{
SunShafts.radialBlurIterations = 3;
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.58f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.maxRadius = Mathf.Lerp(SunShafts.maxRadius, 0.2f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.radialBlurIterations = 2;
SunShafts.sunShaftBlurRadius = 5.86f + ShaftBlurRadiusOffset;
SunShafts.maxRadius = 0.4f;
}
if (Glow_moon)
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Add;
}
else
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Screen;
}
}
}
if (!Application.isPlaying || Init)
{
SkyFog.startDistance = 1f;
}
else
{
SkyFog.startDistance = Mathf.Lerp(SkyFog.startDistance, 1f, Time.deltaTime * speed);
}
if (!Application.isPlaying)
{
SkyFog.GradientBounds = new Vector2(0f, 15000f);
}
else
{
SkyFog.GradientBounds = new Vector2(0f, Mathf.Lerp(SkyFog.GradientBounds.y, 15000f, Time.deltaTime * Trans_speed_sky * speed));
}
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 3.3f, Time.deltaTime * Trans_speed_sky);
SkyFog.lumFac = 0.24f;
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 34.16f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = 51.6f;
SkyFog.HorizFac = 0.4f;
SkyFog.turbidity = 200f;
SkyFog.reileigh = 10f;
SkyFog.mieCoefficient = 0.054f;
SkyFog.mieDirectionalG = 0.913f;
SkyFog.bias = 0.42f;
SkyFog.contrast = 1.51f;
SkyFog.FogSky = false;
SkyFog.TintColor = new Vector3(68f, 155f, 345f);
SkyFog.ClearSkyFac = Mathf.Lerp(SkyFog.ClearSkyFac, 5f, Time.deltaTime * Trans_speed_sky);
}
if (FogPreset == 1)
{
SkyFog.distanceFog = true;
SkyFog.useRadialDistance = true;
SkyFog.heightFog = true;
SkyFog.height = 446.69f;
FogheightOffset = Mathf.Lerp(FogheightOffset, 0f + AddFogHeightOffset, Time.deltaTime * num);
FogdensityOffset = Mathf.Lerp(FogdensityOffset, 0f + AddFogDensityOffset + FogUnityOffset, Time.deltaTime * num);
if (SkyManager != null)
{
if (flag2)
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0585f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.0585f + AddFogDensityOffset + FogUnityOffset;
}
}
else
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0015f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.0015f + AddFogDensityOffset + FogUnityOffset;
}
}
if (flag)
{
if (ImageEffectShafts)
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_day_color;
SunShafts.sunTransform = SkyManager.SunObj.transform;
SunShafts.useDepthTexture = false;
}
}
else if (ImageEffectShafts)
{
if (flag4)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.1f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Moon_Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_night_color;
SunShafts.sunTransform = SkyManager.MoonObj.transform;
SunShafts.useDepthTexture = true;
}
}
if (!Application.isPlaying || Init)
{
SkyFog.startDistance = 1f;
}
else
{
SkyFog.startDistance = Mathf.Lerp(SkyFog.startDistance, 1f, Time.deltaTime * speed);
}
SkyFog.GradientBounds = new Vector2(0f, Mathf.Lerp(SkyFog.GradientBounds.y, 0f, Time.deltaTime * Trans_speed_sky * speed));
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 2.94f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.lumFac = 0.24f;
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 273f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = 3.7f;
SkyFog.HorizFac = 0.4f;
SkyFog.turbidity = 14111f;
SkyFog.reileigh = 411f;
SkyFog.mieCoefficient = 0.054f;
SkyFog.mieDirectionalG = 0.913f;
SkyFog.bias = 0.42f;
SkyFog.contrast = 1.51f;
SkyFog.FogSky = true;
SkyFog.TintColor = new Vector3(68f, 155f, 345f);
SkyFog.ClearSkyFac = Mathf.Lerp(SkyFog.ClearSkyFac, 1f, Time.deltaTime * Trans_speed_sky);
}
if (FogPreset == 2)
{
SkyFog.distanceFog = false;
SkyFog.useRadialDistance = false;
SkyFog.heightFog = true;
SkyFog.height = 2372.5f;
FogheightOffset = Mathf.Lerp(FogheightOffset, 0f + AddFogHeightOffset, Time.deltaTime * num);
FogdensityOffset = Mathf.Lerp(FogdensityOffset, 0f + AddFogDensityOffset + FogUnityOffset, Time.deltaTime * num);
if (SkyManager != null)
{
if (flag2)
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0195f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.0195f + AddFogDensityOffset + FogUnityOffset;
}
}
else
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0015f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.0015f + AddFogDensityOffset + FogUnityOffset;
}
}
if (flag)
{
if (ImageEffectShafts)
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_day_color;
SunShafts.sunTransform = SkyManager.SunObj.transform;
SunShafts.useDepthTexture = false;
SunShafts.radialBlurIterations = 2;
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.86f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.maxRadius = Mathf.Lerp(SunShafts.maxRadius, 0.4f, 0.4f * Time.deltaTime);
if (Glow_sun)
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Add;
}
else
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Screen;
}
}
}
else if (ImageEffectShafts)
{
if (flag4)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.1f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Moon_Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_night_color;
SunShafts.sunTransform = SkyManager.MoonObj.transform;
SunShafts.useDepthTexture = true;
if (Mesh_moon)
{
SunShafts.radialBlurIterations = 3;
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.58f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.maxRadius = Mathf.Lerp(SunShafts.maxRadius, 0.2f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.radialBlurIterations = 2;
SunShafts.sunShaftBlurRadius = 5.86f + ShaftBlurRadiusOffset;
SunShafts.maxRadius = 0.4f;
}
if (Glow_moon)
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Add;
}
else
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Screen;
}
}
}
if (!Application.isPlaying || Init)
{
SkyFog.startDistance = 1f;
}
else
{
SkyFog.startDistance = Mathf.Lerp(SkyFog.startDistance, 1f, Time.deltaTime * speed);
}
SkyFog.GradientBounds = new Vector2(0f, Mathf.Lerp(SkyFog.GradientBounds.y, 20900f, Time.deltaTime * Trans_speed_sky * speed));
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 2.64f, Time.deltaTime * Trans_speed_sky);
SkyFog.lumFac = 0.24f;
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 34.16f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = 3.7f;
SkyFog.HorizFac = 0.4f;
SkyFog.turbidity = 14111f;
SkyFog.reileigh = 411f;
SkyFog.mieCoefficient = 0.054f;
SkyFog.mieDirectionalG = 0.913f;
SkyFog.bias = 0.42f;
SkyFog.contrast = 1.51f;
SkyFog.FogSky = false;
SkyFog.TintColor = new Vector3(68f, 155f, 345f);
SkyFog.ClearSkyFac = Mathf.Lerp(SkyFog.ClearSkyFac, 5f, Time.deltaTime * Trans_speed_sky);
}
if (FogPreset == 3)
{
SkyFog.distanceFog = true;
SkyFog.useRadialDistance = true;
SkyFog.heightFog = true;
SkyFog.height = Mathf.Lerp(SkyFog.height, 550.69f, Time.deltaTime);
FogheightOffset = Mathf.Lerp(FogheightOffset, 0f + AddFogHeightOffset, Time.deltaTime * num);
FogdensityOffset = Mathf.Lerp(FogdensityOffset, 0f + AddFogDensityOffset + FogUnityOffset, Time.deltaTime * num);
if (SkyManager != null)
{
if (flag2)
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.49f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.49f + AddFogDensityOffset + FogUnityOffset;
}
}
else
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0015f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.0015f + AddFogDensityOffset + FogUnityOffset;
}
}
if (flag)
{
if (ImageEffectShafts)
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_day_color;
SunShafts.sunTransform = SkyManager.SunObj.transform;
SunShafts.useDepthTexture = false;
}
}
else if (ImageEffectShafts)
{
if (flag4)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.1f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Moon_Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_night_color;
SunShafts.sunTransform = SkyManager.MoonObj.transform;
SunShafts.useDepthTexture = true;
}
}
if (!Application.isPlaying || Init)
{
SkyFog.startDistance = 1f;
}
else
{
SkyFog.startDistance = Mathf.Lerp(SkyFog.startDistance, 1f, Time.deltaTime * speed);
}
SkyFog.GradientBounds = new Vector2(0f, Mathf.Lerp(SkyFog.GradientBounds.y, 500f, Time.deltaTime * Trans_speed_sky * speed));
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 3f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.lumFac = 0.24f;
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 34.16f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = 3.7f;
SkyFog.HorizFac = 0.4f;
SkyFog.turbidity = 14111f;
SkyFog.reileigh = 3.21f;
SkyFog.mieCoefficient = 0.15f;
SkyFog.mieDirectionalG = 0.913f;
SkyFog.bias = 0.42f;
SkyFog.contrast = 1.51f;
SkyFog.FogSky = true;
SkyFog.TintColor = new Vector3(68f, 155f, 345f);
SkyFog.ClearSkyFac = Mathf.Lerp(SkyFog.ClearSkyFac, 3.7638f, Time.deltaTime * Trans_speed_sky);
}
if (FogPreset == 4)
{
SkyFog.distanceFog = true;
SkyFog.useRadialDistance = true;
SkyFog.heightFog = true;
SkyFog.height = Mathf.Lerp(SkyFog.height, 917.69f, Time.deltaTime);
FogheightOffset = Mathf.Lerp(FogheightOffset, 0f + AddFogHeightOffset, Time.deltaTime * num);
FogdensityOffset = Mathf.Lerp(FogdensityOffset, 0f + AddFogDensityOffset + FogUnityOffset, Time.deltaTime * num);
if (SkyManager != null)
{
if (flag2)
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0065f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.0065f + AddFogDensityOffset + FogUnityOffset;
}
}
else
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0015f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.0015f + AddFogDensityOffset + FogUnityOffset;
}
}
if (flag)
{
if (ImageEffectShafts)
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_day_color;
SunShafts.sunTransform = SkyManager.SunObj.transform;
SunShafts.useDepthTexture = false;
}
}
else if (ImageEffectShafts)
{
if (flag4)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.1f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Moon_Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_night_color;
SunShafts.sunTransform = SkyManager.MoonObj.transform;
SunShafts.useDepthTexture = true;
}
}
if (!Application.isPlaying || Init)
{
SkyFog.startDistance = 1f;
}
else
{
SkyFog.startDistance = Mathf.Lerp(SkyFog.startDistance, 1f, Time.deltaTime * speed);
}
SkyFog.GradientBounds = new Vector2(0f, Mathf.Lerp(SkyFog.GradientBounds.y, 20900f, Time.deltaTime * Trans_speed_sky * speed));
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 4.2f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.lumFac = 0.24f;
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 34.16f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = 3.7f;
SkyFog.HorizFac = 0.4f;
SkyFog.turbidity = Mathf.Lerp(SkyFog.turbidity, 111f, Time.deltaTime);
SkyFog.reileigh = 411f;
SkyFog.mieCoefficient = 0.054f;
SkyFog.mieDirectionalG = 0.913f;
SkyFog.bias = 0.42f;
SkyFog.contrast = 1.05f;
SkyFog.FogSky = true;
SkyFog.TintColor = new Vector3(68f, 155f, 345f);
SkyFog.ClearSkyFac = Mathf.Lerp(SkyFog.ClearSkyFac, 4.5638f, Time.deltaTime * Trans_speed_sky);
}
if (FogPreset == 5)
{
SkyFog.distanceFog = true;
SkyFog.useRadialDistance = true;
SkyFog.heightFog = true;
SkyFog.height = 446.69f;
FogheightOffset = Mathf.Lerp(FogheightOffset, 0f + AddFogHeightOffset, Time.deltaTime * num);
FogdensityOffset = Mathf.Lerp(FogdensityOffset, 0f + AddFogDensityOffset + FogUnityOffset, Time.deltaTime * num);
if (SkyManager != null)
{
if (flag2)
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0185f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.0185f + AddFogDensityOffset + FogUnityOffset;
}
}
else
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0015f + FogdensityOffset, Time.deltaTime * 12f);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.0015f + AddFogDensityOffset + FogUnityOffset;
}
}
if (flag)
{
if (ImageEffectShafts)
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_day_color;
SunShafts.sunTransform = SkyManager.SunObj.transform;
SunShafts.useDepthTexture = false;
}
}
else if (ImageEffectShafts)
{
if (flag4)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.1f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Moon_Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_night_color;
SunShafts.sunTransform = SkyManager.MoonObj.transform;
SunShafts.useDepthTexture = true;
}
}
if (!Application.isPlaying || Init)
{
SkyFog.startDistance = 1f;
}
else
{
SkyFog.startDistance = Mathf.Lerp(SkyFog.startDistance, 1f, Time.deltaTime * speed);
}
SkyFog.GradientBounds = new Vector2(0f, Mathf.Lerp(SkyFog.GradientBounds.y, 1f, Time.deltaTime * Trans_speed_sky * speed));
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 2.7f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.lumFac = 0.24f;
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 273f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = 3.7f;
SkyFog.HorizFac = 0.4f;
SkyFog.turbidity = 14111f;
SkyFog.reileigh = 411f;
SkyFog.mieCoefficient = 0.054f;
SkyFog.mieDirectionalG = 0.913f;
SkyFog.bias = 0.42f;
SkyFog.contrast = 1.51f;
SkyFog.FogSky = false;
SkyFog.TintColor = new Vector3(68f, 155f, 345f);
SkyFog.ClearSkyFac = Mathf.Lerp(SkyFog.ClearSkyFac, 1f, Time.deltaTime * Trans_speed_sky);
}
if (FogPreset == 6)
{
SkyFog.distanceFog = true;
SkyFog.useRadialDistance = true;
SkyFog.heightFog = true;
SkyFog.height = 274.06f;
FogheightOffset = Mathf.Lerp(FogheightOffset, 0f + AddFogHeightOffset, Time.deltaTime * num);
FogdensityOffset = Mathf.Lerp(FogdensityOffset, 0f + AddFogDensityOffset + FogUnityOffset, Time.deltaTime * num);
if (SkyManager != null)
{
if (flag2)
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 3.99f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 3.99f + AddFogDensityOffset + FogUnityOffset;
}
}
else
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 3.99f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 3.99f + AddFogDensityOffset + FogUnityOffset;
}
}
if (flag)
{
if (ImageEffectShafts)
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_day_color;
SunShafts.sunTransform = SkyManager.SunObj.transform;
SunShafts.useDepthTexture = false;
SunShafts.radialBlurIterations = 2;
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.86f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.maxRadius = Mathf.Lerp(SunShafts.maxRadius, 0.4f, 0.4f * Time.deltaTime);
if (Glow_sun)
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Add;
}
else
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Screen;
}
}
}
else if (ImageEffectShafts)
{
if (flag4)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.1f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Moon_Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_night_color;
SunShafts.sunTransform = SkyManager.MoonObj.transform;
SunShafts.useDepthTexture = true;
if (Mesh_moon)
{
SunShafts.radialBlurIterations = 3;
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.58f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.maxRadius = Mathf.Lerp(SunShafts.maxRadius, 0.2f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.radialBlurIterations = 2;
SunShafts.sunShaftBlurRadius = 5.86f + ShaftBlurRadiusOffset;
SunShafts.maxRadius = 0.4f;
}
if (Glow_moon)
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Add;
}
else
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Screen;
}
}
}
if (!Application.isPlaying || Init)
{
SkyFog.startDistance = 1f;
}
else
{
SkyFog.startDistance = Mathf.Lerp(SkyFog.startDistance, 1f, Time.deltaTime * speed);
}
SkyFog.GradientBounds = new Vector2(0f, Mathf.Lerp(SkyFog.GradientBounds.y, 32900f, Time.deltaTime * Trans_speed_sky * speed));
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 1.9f, Time.deltaTime * Trans_speed_sky);
SkyFog.lumFac = 0.31f;
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 34.16f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = 0.06f;
SkyFog.HorizFac = 68.41f;
SkyFog.turbidity = 14111f;
SkyFog.reileigh = 474f;
SkyFog.mieCoefficient = 0.054f;
SkyFog.mieDirectionalG = 0.913f;
SkyFog.bias = 0.42f;
SkyFog.contrast = 0.67f;
SkyFog.FogSky = true;
SkyFog.TintColor = new Vector3(36f, 108f, 345f);
SkyFog.ClearSkyFac = Mathf.Lerp(SkyFog.ClearSkyFac, 2.95f, Time.deltaTime * Trans_speed_sky);
}
if (FogPreset == 7)
{
SkyFog.distanceFog = false;
SkyFog.useRadialDistance = true;
SkyFog.heightFog = true;
SkyFog.height = 546.69f;
FogheightOffset = Mathf.Lerp(FogheightOffset, 50f + AddFogHeightOffset, Time.deltaTime * num);
FogdensityOffset = Mathf.Lerp(FogdensityOffset, 0f + AddFogDensityOffset + FogUnityOffset, Time.deltaTime * num);
if (SkyManager != null)
{
if (flag2)
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0132f + FogdensityOffset, Time.deltaTime * num);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.0132f + AddFogDensityOffset + FogUnityOffset;
}
}
else
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0125f + FogdensityOffset, Time.deltaTime * num);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.0125f + AddFogDensityOffset + FogUnityOffset;
}
}
if (flag)
{
if (ImageEffectShafts)
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime * num);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Shafts_intensity, 0.4f * Time.deltaTime * num);
}
SunShafts.sunColor = Rays_day_color;
SunShafts.sunTransform = SkyManager.SunObj.transform;
SunShafts.useDepthTexture = false;
}
}
else if (ImageEffectShafts)
{
if (flag4)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.1f * Time.deltaTime * num);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Moon_Shafts_intensity, 0.4f * Time.deltaTime * num);
}
SunShafts.sunColor = Rays_night_color;
SunShafts.sunTransform = SkyManager.MoonObj.transform;
SunShafts.useDepthTexture = true;
}
}
if (!Application.isPlaying || Init)
{
SkyFog.startDistance = 1f;
}
else
{
SkyFog.startDistance = Mathf.Lerp(SkyFog.startDistance, 1f, Time.deltaTime * speed);
}
SkyFog.GradientBounds = new Vector2(0f, Mathf.Lerp(SkyFog.GradientBounds.y, 20900f, Time.deltaTime * Trans_speed_sky * speed));
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 0.6f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.lumFac = 0.24f;
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 34.16f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = 0.07f;
SkyFog.HorizFac = 0.4f;
SkyFog.turbidity = 14f;
SkyFog.reileigh = 411f;
SkyFog.mieCoefficient = 0.054f;
SkyFog.mieDirectionalG = 0.913f;
SkyFog.bias = 0.42f;
SkyFog.contrast = 2.51f;
SkyFog.FogSky = true;
SkyFog.TintColor = new Vector3(68f, 587.6f, 345f);
SkyFog.ClearSkyFac = Mathf.Lerp(SkyFog.ClearSkyFac, 4.5f, Time.deltaTime * Trans_speed_sky);
}
if ((FogPreset == 9) | (FogPreset == 10))
{
SkyFog.distanceFog = false;
SkyFog.useRadialDistance = false;
SkyFog.heightFog = true;
SkyFog.height = 27.69f;
FogheightOffset = Mathf.Lerp(FogheightOffset, 0f + AddFogHeightOffset, Time.deltaTime * num);
FogdensityOffset = Mathf.Lerp(FogdensityOffset, 0f + AddFogDensityOffset + FogUnityOffset, Time.deltaTime * num);
if (SkyManager != null)
{
if (flag2)
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.02f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.02f + AddFogDensityOffset + FogUnityOffset;
}
}
else
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.015f + FogdensityOffset, Time.deltaTime);
if (!Application.isPlaying)
{
SkyFog.heightDensity = 0.015f + AddFogDensityOffset + FogUnityOffset;
}
}
if (flag)
{
if (ImageEffectShafts)
{
if (FogPreset == 10)
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Shafts_intensity + AddShaftsIntensityUnder, 0.4f * Time.deltaTime);
}
SunShafts.radialBlurIterations = 2;
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.86f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.maxRadius = Mathf.Lerp(SunShafts.maxRadius, 0.4f + AddShaftsSizeUnder, 0.4f * Time.deltaTime);
if (Glow_sun)
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Add;
}
else
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Screen;
}
SunShafts.useDepthTexture = false;
}
else
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 1.1f + AddShaftsIntensityUnder, 0.4f * Time.deltaTime);
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.4f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.maxRadius = Mathf.Lerp(SunShafts.maxRadius, 1.52f + AddShaftsSizeUnder, 0.4f * Time.deltaTime);
}
SunShafts.radialBlurIterations = 2;
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Screen;
SunShafts.useDepthTexture = true;
}
SunShafts.sunColor = Rays_day_color;
SunShafts.sunTransform = SkyManager.SunObj.transform;
}
}
else if (ImageEffectShafts)
{
if (FogPreset == 10)
{
if (flag4)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.1f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Moon_Shafts_intensity + AddShaftsIntensityUnder, 0.4f * Time.deltaTime);
}
}
else if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 1.1f + AddShaftsIntensityUnder, 0.4f * Time.deltaTime);
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.4f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.maxRadius = Mathf.Lerp(SunShafts.maxRadius, 1.52f + AddShaftsSizeUnder, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_night_color;
SunShafts.sunTransform = SkyManager.MoonObj.transform;
SunShafts.useDepthTexture = true;
if (Mesh_moon)
{
SunShafts.radialBlurIterations = 3;
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.58f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.maxRadius = Mathf.Lerp(SunShafts.maxRadius, 0.2f + AddShaftsSizeUnder, 0.4f * Time.deltaTime);
}
else
{
SunShafts.radialBlurIterations = 2;
SunShafts.sunShaftBlurRadius = 5.86f + ShaftBlurRadiusOffset;
SunShafts.maxRadius = 0.4f + AddShaftsSizeUnder;
}
if (Glow_moon)
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Add;
}
else
{
SunShafts.screenBlendMode = SunShaftsSkyMaster.ShaftsScreenBlendMode.Screen;
}
}
}
if (!Application.isPlaying || Init)
{
SkyFog.startDistance = 1f;
}
else
{
SkyFog.startDistance = Mathf.Lerp(SkyFog.startDistance, 1f, Time.deltaTime * speed);
}
if (!Application.isPlaying)
{
SkyFog.GradientBounds = new Vector2(0f, 5000f);
}
else
{
SkyFog.GradientBounds = new Vector2(0f, Mathf.Lerp(SkyFog.GradientBounds.y, 5000f, Time.deltaTime * Trans_speed_sky * speed));
}
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 3.2f, Time.deltaTime * Trans_speed_sky);
SkyFog.lumFac = 0.97f;
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 34.16f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = 3.7f;
SkyFog.HorizFac = 0.4f;
SkyFog.turbidity = 14111f;
SkyFog.reileigh = 411f;
SkyFog.mieCoefficient = 0.054f;
SkyFog.mieDirectionalG = 0.913f;
SkyFog.bias = 0.42f;
SkyFog.contrast = 3.8f;
SkyFog.FogSky = true;
SkyFog.TintColor = new Vector3(88.88f, 555f, 145f);
SkyFog.ClearSkyFac = Mathf.Lerp(SkyFog.ClearSkyFac, 1f, Time.deltaTime * Trans_speed_sky);
}
if (FogPreset == 11)
{
SkyFog.distanceFog = true;
SkyFog.useRadialDistance = false;
SkyFog.heightFog = true;
FogheightOffset = Mathf.Lerp(FogheightOffset, 0f + AddFogHeightOffset, Time.deltaTime * num);
FogdensityOffset = Mathf.Lerp(FogdensityOffset, 0f + AddFogDensityOffset + FogUnityOffset, Time.deltaTime * num);
if (SkyManager != null)
{
if (flag2)
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.001f + FogdensityOffset, Time.deltaTime);
SkyFog.height = Mathf.Lerp(SkyFog.height, 1505.69f, Time.deltaTime * 0.1f);
if (!Application.isPlaying || Init)
{
SkyFog.heightDensity = 0.001f + AddFogDensityOffset + FogUnityOffset;
SkyFog.height = 1505.69f;
}
}
else
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.001f + FogdensityOffset, Time.deltaTime);
SkyFog.height = Mathf.Lerp(SkyFog.height, 15.69f, Time.deltaTime);
if (!Application.isPlaying || Init)
{
SkyFog.heightDensity = 0.001f + AddFogDensityOffset + FogUnityOffset;
SkyFog.height = 15.69f;
}
}
if (flag)
{
if (ImageEffectShafts)
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_day_color;
SunShafts.sunTransform = SkyManager.SunObj.transform;
SunShafts.useDepthTexture = true;
}
}
else if (ImageEffectShafts)
{
if (flag4)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.1f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Moon_Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunColor = Rays_night_color;
SunShafts.sunTransform = SkyManager.MoonObj.transform;
SunShafts.useDepthTexture = true;
}
}
if (!Application.isPlaying || Init)
{
SkyFog.startDistance = 200f;
}
else
{
SkyFog.startDistance = Mathf.Lerp(SkyFog.startDistance, 200f, Time.deltaTime * speed);
}
SkyFog.GradientBounds = new Vector2(0f, Mathf.Lerp(SkyFog.GradientBounds.y, 1f, Time.deltaTime * Trans_speed_sky * speed));
if (!Application.isPlaying || Init)
{
SkyFog.GradientBounds = new Vector2(0f, 1f);
SkyFog.luminance = 4.2f;
SkyFog.ScatterFac = 34.16f;
SkyFog.turbidity = 111f;
SkyFog.ClearSkyFac = 4.8f;
}
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 4.2f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.lumFac = 0.14f;
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 34.16f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = 3.7f;
SkyFog.HorizFac = 0.4f;
SkyFog.turbidity = Mathf.Lerp(SkyFog.turbidity, 111f, Time.deltaTime);
SkyFog.reileigh = 411f;
SkyFog.mieCoefficient = 0.054f;
SkyFog.mieDirectionalG = 0.913f;
SkyFog.bias = 0.42f;
SkyFog.contrast = 2.05f;
SkyFog.FogSky = false;
SkyFog.TintColor = new Vector3(68f, 155f, 345f);
SkyFog.ClearSkyFac = Mathf.Lerp(SkyFog.ClearSkyFac, 4.8f, Time.deltaTime * Trans_speed_sky);
}
if (FogPreset == 12)
{
SkyFog.distanceFog = false;
SkyFog.useRadialDistance = false;
SkyFog.heightFog = true;
FogheightOffset = Mathf.Lerp(FogheightOffset, 0f + AddFogHeightOffset, Time.deltaTime * num);
FogdensityOffset = Mathf.Lerp(FogdensityOffset, 0f + AddFogDensityOffset + FogUnityOffset, Time.deltaTime * num);
if (SkyManager != null)
{
if (flag2)
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.031f + FogdensityOffset, Time.deltaTime);
SkyFog.height = Mathf.Lerp(SkyFog.height, 1505.69f, Time.deltaTime * 0.1f);
if (!Application.isPlaying || Init)
{
SkyFog.heightDensity = 0.031f + AddFogDensityOffset + FogUnityOffset;
SkyFog.height = 1505.69f;
}
}
else
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.001f + FogdensityOffset, Time.deltaTime);
SkyFog.height = Mathf.Lerp(SkyFog.height, 15.69f, Time.deltaTime);
if (!Application.isPlaying || Init)
{
SkyFog.heightDensity = 0.001f + AddFogDensityOffset + FogUnityOffset;
SkyFog.height = 15.69f;
}
}
if (flag)
{
if (ImageEffectShafts)
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.4f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.sunColor = Rays_day_color;
SunShafts.sunTransform = SkyManager.SunObj.transform;
SunShafts.useDepthTexture = true;
}
}
else if (ImageEffectShafts)
{
if (flag4)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.1f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Moon_Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.4f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.sunColor = Rays_night_color;
SunShafts.sunTransform = SkyManager.MoonObj.transform;
SunShafts.useDepthTexture = true;
}
}
if (!Application.isPlaying || Init)
{
SkyFog.startDistance = 200f;
}
else
{
SkyFog.startDistance = Mathf.Lerp(SkyFog.startDistance, 200f, Time.deltaTime * speed);
}
SkyFog.GradientBounds = new Vector2(0f, Mathf.Lerp(SkyFog.GradientBounds.y, 21111f, Time.deltaTime * Trans_speed_sky * speed));
if (!Application.isPlaying || Init)
{
SkyFog.GradientBounds = new Vector2(0f, 21111f);
SkyFog.luminance = 0.84f;
SkyFog.ScatterFac = 34.16f;
SkyFog.turbidity = 61.41f;
SkyFog.ClearSkyFac = 4.8f;
}
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 0.84f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.lumFac = 0.16f;
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 34.16f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = 5.4f;
SkyFog.HorizFac = 0.4f;
SkyFog.turbidity = Mathf.Lerp(SkyFog.turbidity, 61.41f, Time.deltaTime);
SkyFog.reileigh = 303.24f;
SkyFog.mieCoefficient = 0.074f;
SkyFog.mieDirectionalG = 0.88f;
SkyFog.bias = 0.62f;
SkyFog.contrast = 3.75f;
SkyFog.FogSky = true;
SkyFog.TintColor = new Vector3(35.8f, 155f, 345f);
SkyFog.ClearSkyFac = Mathf.Lerp(SkyFog.ClearSkyFac, 10.91f, Time.deltaTime * Trans_speed_sky);
}
if ((FogPreset == 13) | (FogPreset == 14))
{
SkyFog.distanceFog = false;
SkyFog.useRadialDistance = true;
SkyFog.heightFog = true;
FogheightOffset = Mathf.Lerp(FogheightOffset, 30f + AddFogHeightOffset, Time.deltaTime * num * 20f);
FogdensityOffset = Mathf.Lerp(FogdensityOffset, 0f + AddFogDensityOffset + FogUnityOffset, Time.deltaTime * num);
if (SkyManager != null)
{
if (flag2)
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.05f + FogdensityOffset, Time.deltaTime);
SkyFog.height = Mathf.Lerp(SkyFog.height, 1505.69f, Time.deltaTime * 0.1f);
if (!Application.isPlaying || Init)
{
SkyFog.heightDensity = 0.05f + AddFogDensityOffset + FogUnityOffset;
SkyFog.height = 1505.69f;
}
}
else
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.05f + FogdensityOffset, Time.deltaTime);
SkyFog.height = Mathf.Lerp(SkyFog.height, 15.69f, Time.deltaTime);
if (!Application.isPlaying || Init)
{
SkyFog.heightDensity = 0.05f + AddFogDensityOffset + FogUnityOffset;
SkyFog.height = 15.69f;
}
}
if (flag)
{
if (ImageEffectShafts)
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 0f, 0.4f * Time.deltaTime);
SunShafts.sunColor = Rays_day_color;
SunShafts.sunTransform = SkyManager.SunObj.transform;
SunShafts.useDepthTexture = true;
}
}
else if (ImageEffectShafts)
{
if (flag4)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.1f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 0f, 0.4f * Time.deltaTime);
SunShafts.sunColor = Rays_night_color;
SunShafts.sunTransform = SkyManager.MoonObj.transform;
SunShafts.useDepthTexture = true;
}
}
if (!Application.isPlaying || Init)
{
SkyFog.startDistance = 20f;
}
else
{
SkyFog.startDistance = Mathf.Lerp(SkyFog.startDistance, 20f, Time.deltaTime * speed);
}
SkyFog.GradientBounds = new Vector2(0f, Mathf.Lerp(SkyFog.GradientBounds.y, 1500f, Time.deltaTime * Trans_speed_sky * speed));
if (!Application.isPlaying || Init)
{
SkyFog.GradientBounds = new Vector2(0f, 1500f);
SkyFog.luminance = 0.9f;
SkyFog.ScatterFac = 24f;
SkyFog.turbidity = 61.41f;
SkyFog.ClearSkyFac = 2f;
}
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 0.9f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.lumFac = 0.7f;
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 24f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = 0.02f;
SkyFog.HorizFac = 0.4f;
SkyFog.turbidity = Mathf.Lerp(SkyFog.turbidity, 61.41f, Time.deltaTime);
SkyFog.reileigh = 303.24f;
SkyFog.mieCoefficient = 0.074f;
SkyFog.mieDirectionalG = 0.88f;
SkyFog.bias = 0.62f;
SkyFog.contrast = 3.45f;
SkyFog.FogSky = true;
SkyFog.TintColor = new Vector3(81.8f, 155f, 26f);
SkyFog.ClearSkyFac = Mathf.Lerp(SkyFog.ClearSkyFac, 2f, Time.deltaTime * Trans_speed_sky);
}
if (FogPreset == 15)
{
SkyFog.distanceFog = false;
SkyFog.useRadialDistance = false;
SkyFog.heightFog = true;
FogheightOffset = Mathf.Lerp(FogheightOffset, 113f + AddFogHeightOffset, Time.deltaTime * num * 20f);
FogdensityOffset = Mathf.Lerp(FogdensityOffset, 0f + AddFogDensityOffset + FogUnityOffset, Time.deltaTime * num);
if (SkyManager != null)
{
if (flag)
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0015f + FogdensityOffset, Time.deltaTime);
SkyFog.height = Mathf.Lerp(SkyFog.height, 155.69f, Time.deltaTime * 0.1f);
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 1.9f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.bias = Mathf.Lerp(SkyFog.bias, 1.66f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.contrast = Mathf.Lerp(SkyFog.contrast, 6.52f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.mieCoefficient = Mathf.Lerp(SkyFog.mieCoefficient, 0.13f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 180f, Time.deltaTime * Trans_speed_sky);
SkyFog.mieDirectionalG = Mathf.Lerp(SkyFog.mieDirectionalG, 0.93f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = Mathf.Lerp(SkyFog.TurbFac, 320f, Time.deltaTime * Trans_speed_sky);
SkyFog.HorizFac = Mathf.Lerp(SkyFog.HorizFac, 421f, Time.deltaTime * Trans_speed_sky);
SkyFog.lumFac = Mathf.Lerp(SkyFog.lumFac, 0.21f, Time.deltaTime * Trans_speed_sky);
SkyFog.turbidity = Mathf.Lerp(SkyFog.turbidity, 9.7f, Time.deltaTime * Trans_speed_sky);
SkyFog.reileigh = Mathf.Lerp(SkyFog.reileigh, 0.8f, Time.deltaTime * Trans_speed_sky);
if (!Application.isPlaying || Init)
{
SkyFog.heightDensity = 0.0015f + AddFogDensityOffset + FogUnityOffset;
SkyFog.height = 155.69f;
SkyFog.luminance = 1.9f;
SkyFog.bias = 1.66f;
SkyFog.contrast = 6.52f;
SkyFog.mieCoefficient = 0.13f;
SkyFog.ScatterFac = 180f;
SkyFog.mieDirectionalG = 0.93f;
SkyFog.TurbFac = 320f;
SkyFog.HorizFac = 421f;
SkyFog.lumFac = 0.21f;
SkyFog.turbidity = 9.7f;
SkyFog.reileigh = 0.8f;
}
SkyFog.Sun = SkyManager.SunObj.transform;
}
else
{
SkyFog.heightDensity = Mathf.Lerp(SkyFog.heightDensity, 0.0045f + FogdensityOffset, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.height = Mathf.Lerp(SkyFog.height, 155.69f, Time.deltaTime);
SkyFog.luminance = Mathf.Lerp(SkyFog.luminance, 3.04f, Time.deltaTime * Trans_speed_sky * speed * 1f);
SkyFog.bias = Mathf.Lerp(SkyFog.bias, 1.3f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.mieCoefficient = Mathf.Lerp(SkyFog.mieCoefficient, 0.3f, Time.deltaTime * Trans_speed_sky * speed);
SkyFog.ScatterFac = Mathf.Lerp(SkyFog.ScatterFac, 10f, Time.deltaTime * Trans_speed_sky * 1f);
SkyFog.mieDirectionalG = Mathf.Lerp(SkyFog.mieDirectionalG, 0.7f, Time.deltaTime * Trans_speed_sky);
SkyFog.TurbFac = Mathf.Lerp(SkyFog.TurbFac, 2f, Time.deltaTime * Trans_speed_sky * 1f);
SkyFog.HorizFac = Mathf.Lerp(SkyFog.HorizFac, 10f, Time.deltaTime * Trans_speed_sky * 1f);
SkyFog.lumFac = Mathf.Lerp(SkyFog.lumFac, 0.4f, Time.deltaTime * Trans_speed_sky);
SkyFog.turbidity = Mathf.Lerp(SkyFog.turbidity, 0f, Time.deltaTime * Trans_speed_sky * speed * 4f);
SkyFog.reileigh = Mathf.Lerp(SkyFog.reileigh, 0.01f, Time.deltaTime * Trans_speed_sky);
if (!Application.isPlaying || Init)
{
SkyFog.heightDensity = 0.0045f + AddFogDensityOffset + FogUnityOffset;
SkyFog.height = 155.69f;
SkyFog.luminance = 3.04f;
SkyFog.bias = 1.3f;
SkyFog.contrast = 1f;
SkyFog.mieCoefficient = 0.3f;
SkyFog.ScatterFac = 10f;
SkyFog.mieDirectionalG = 0.7f;
SkyFog.TurbFac = 2f;
SkyFog.HorizFac = 10f;
SkyFog.lumFac = 0.4f;
SkyFog.turbidity = 0f;
SkyFog.reileigh = 0.01f;
}
if (SkyManager.Rot_Sun_X < -11f)
{
SkyFog.Sun = SkyManager.MoonObj.transform;
SkyFog.contrast = Mathf.Lerp(SkyFog.contrast, 0.7f, Time.deltaTime * Trans_speed_sky * speed * 0.2f);
}
else
{
SkyFog.Sun = SkyManager.SunObj.transform;
SkyFog.contrast = Mathf.Lerp(SkyFog.contrast, 2.5f, Time.deltaTime * Trans_speed_sky * speed * 0.1f);
}
}
if (flag)
{
if (ImageEffectShafts)
{
if (flag3)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.4f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.4f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.sunColor = Rays_day_color;
SunShafts.sunTransform = SkyManager.SunObj.transform;
SunShafts.useDepthTexture = true;
}
}
else if (ImageEffectShafts)
{
if (flag4)
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, 0f, 0.1f * Time.deltaTime);
}
else
{
SunShafts.sunShaftIntensity = Mathf.Lerp(SunShafts.sunShaftIntensity, Moon_Shafts_intensity, 0.4f * Time.deltaTime);
}
SunShafts.sunShaftBlurRadius = Mathf.Lerp(SunShafts.sunShaftBlurRadius, 5.4f + ShaftBlurRadiusOffset, 0.4f * Time.deltaTime);
SunShafts.sunColor = Rays_night_color;
SunShafts.sunTransform = SkyManager.MoonObj.transform;
SunShafts.useDepthTexture = true;
}
}
if (!Application.isPlaying || Init)
{
SkyFog.startDistance = 20f;
}
else
{
SkyFog.startDistance = Mathf.Lerp(SkyFog.startDistance, 20f, Time.deltaTime * speed);
}
SkyFog.GradientBounds = new Vector2(0f, Mathf.Lerp(SkyFog.GradientBounds.y, 2000f, Time.deltaTime * Trans_speed_sky * speed));
if (!Application.isPlaying || Init)
{
SkyFog.GradientBounds = new Vector2(0f, 1000f);
SkyFog.turbidity = 9.7f;
SkyFog.ClearSkyFac = 2f;
}
SkyFog.FogSky = true;
SkyFog.TintColor = new Vector3(65.4f, 155f, 345f);
SkyFog.ClearSkyFac = Mathf.Lerp(SkyFog.ClearSkyFac, 6.25f, Time.deltaTime * Trans_speed_sky);
}
if (GradientHolders.Count > 0 && FogPreset < GradientHolders.Count && GradientHolders[FogPreset] != null && GradientHolders[FogPreset].DistGradient != SkyFog.DistGradient)
{
if (Lerp_gradient)
{
if (Mathf.Abs(SkyFog.DistGradient.colorKeys.Length - GradientHolders[FogPreset].DistGradient.colorKeys.Length) == 0)
{
GradientColorKey[] array = new GradientColorKey[8];
for (int i = 0; i < GradientHolders[FogPreset].DistGradient.colorKeys.Length; i++)
{
array[i] = new GradientColorKey(Color.Lerp(SkyFog.DistGradient.colorKeys[i].color, GradientHolders[FogPreset].DistGradient.colorKeys[i].color, Time.deltaTime * 1.4f), Mathf.Lerp(SkyFog.DistGradient.colorKeys[i].time, GradientHolders[FogPreset].DistGradient.colorKeys[i].time, Time.deltaTime * 0.4f));
}
SkyFog.DistGradient.SetKeys(array, SkyFog.DistGradient.alphaKeys);
}
else
{
SkyFog.DistGradient.SetKeys(GradientHolders[FogPreset].DistGradient.colorKeys, GradientHolders[FogPreset].DistGradient.alphaKeys);
}
}
else
{
SkyFog.DistGradient.SetKeys(GradientHolders[FogPreset].DistGradient.colorKeys, GradientHolders[FogPreset].DistGradient.alphaKeys);
}
}
if (SkyManager != null && !Use_both_fogs)
{
if ((SkyManager.Weather == SkyMasterManager.Weather_types.Foggy) | (SkyManager.Weather == SkyMasterManager.Weather_types.HeavyFog) | (SkyManager.Season == 4))
{
SkyManager.Use_fog = false;
RenderSettings.fog = false;
RenderSettings.fogDensity = 0.0005f;
FogPreset = 1;
}
else
{
RenderSettings.fogDensity = 5E-05f;
}
}
if (UseFogCurves)
{
float calcColorTime = SkyManager.calcColorTime;
FogheightOffset = heightOffsetFogCurve.Evaluate(calcColorTime);
AddFogHeightOffset = 0f;
if (!FogHeightByTerrain)
{
SkyFog.height = FogheightOffset;
}
SkyFog.FogSky = SkyFogOn;
SkyFog.heightFog = HeightFogOn;
SkyFog.distanceFog = DistanceFogOn;
SkyFog.startDistance = VFogDistance;
SkyFog.luminance = luminanceVFogCurve.Evaluate(calcColorTime);
SkyFog.lumFac = lumFactorFogCurve.Evaluate(calcColorTime);
SkyFog.ScatterFac = scatterFacFogCurve.Evaluate(calcColorTime);
SkyFog.turbidity = turbidityFogCurve.Evaluate(calcColorTime);
SkyFog.TurbFac = turbFacFogCurve.Evaluate(calcColorTime);
SkyFog.HorizFac = horizonFogCurve.Evaluate(calcColorTime);
SkyFog.contrast = contrastFogCurve.Evaluate(calcColorTime);
}
if (FogHeightByTerrain)
{
if (Mesh_Terrain)
{
SkyFog.height = base.transform.position.y + 25f + FogheightOffset;
}
if (Terrain.activeTerrain != null)
{
SkyFog.height = base.transform.position.y + 25f + FogheightOffset;
}
}
}
}
}