Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Here is how i made the light dimming go syncronised with when the skyboxes blend:
- //I have included my code that i changed!
- //NOTE: In update, remove the call for AdjustLighting(false) !! Otherwise it will still happen with the old timing
- private void SkyboxBlend(){
- float temp = 0;
- switch(_tod){
- case TimeOfDay.Sunrise:
- temp = (_TimeOfDay - Sunrise) / DayCycleInSeconds * SkyboxBlendModifier;;
- break;
- case TimeOfDay.Sunset:
- temp = (_TimeOfDay - Sunset) / DayCycleInSeconds * SkyboxBlendModifier;
- temp = 1 - temp;
- //I added the code below and swapped the pos variable to temp
- RenderSettings.ambientLight = new Color(
- AmbientLightMin.r + AmbientLightMax.r * temp,
- AmbientLightMin.g + AmbientLightMax.g * temp,
- AmbientLightMin.b + AmbientLightMax.b * temp);
- Sun.GetComponent<Light>().intensity = Sun.GetComponent<Sun>().MaxLightBrightness * temp;
- //Swaped the variable for the sun too (for me im just changing one sun, if you have a for loop
- //just modify that to work!
- break;
- default:
- Debug.LogWarning("Time of Day wasnt Sunrise or sunset!");
- break;
- }
- MainCamera.GetComponent<Skybox>().material.SetFloat("_Blend", temp);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement