TimeChanger.cs 558 B

123456789101112131415161718
  1. using UnityEngine;
  2. public class TimeChanger : MonoBehaviour
  3. {
  4. [SerializeField] Material skybox;
  5. [SerializeField] float rotationSpeed = 100f;
  6. private static readonly int Rotation = Shader.PropertyToID("_Rotation");
  7. private static readonly int Exposure = Shader.PropertyToID("_Exposure");
  8. public void UpdateSkybox(float normalizedTime)
  9. {
  10. skybox.SetFloat(Rotation, normalizedTime * rotationSpeed);
  11. float exposureValue = Mathf.Lerp(5f, 0.15f, normalizedTime);
  12. skybox.SetFloat(Exposure, exposureValue);
  13. }
  14. }