fix sun
This commit is contained in:
@@ -78,14 +78,14 @@ public class TimeManager : MonoBehaviour
|
|||||||
private void RotateSun()
|
private void RotateSun()
|
||||||
{
|
{
|
||||||
float intensityMultiplier = 1;
|
float intensityMultiplier = 1;
|
||||||
float timeofDay = (float)CurrentTime.TotalSeconds / 86400;
|
float timeofDay = (float)(CurrentTime.TotalDays - CurrentTime.Days);
|
||||||
_sunLight.transform.localRotation = Quaternion.Euler((timeofDay * 360f) - 90, 170, 0);
|
_sunLight.transform.localRotation = Quaternion.Euler((timeofDay * 360f) - 90, 170, 0);
|
||||||
if (_currentTime > _sunriseTime && _currentTime < _sunsetTime)
|
if (timeofDay > _sunriseTime.TotalDays && timeofDay < _sunsetTime.TotalDays)
|
||||||
{
|
{
|
||||||
if (timeofDay <= 0.25f)
|
if (timeofDay <= _sunsetTime.TotalDays)
|
||||||
intensityMultiplier = Mathf.Clamp01((timeofDay - 0.23f) * (1 / 0.02f));
|
intensityMultiplier = Mathf.Clamp01((timeofDay - ((float)_sunsetTime.TotalDays - 0.02f)) * (1 / 0.02f));
|
||||||
if (timeofDay >= 0.73f)
|
if (timeofDay >= _sunriseTime.TotalDays)
|
||||||
intensityMultiplier = Mathf.Clamp01(1 - (timeofDay - 0.73f) * (1 / 0.02f));
|
intensityMultiplier = Mathf.Clamp01(1 - (timeofDay - ((float)_sunriseTime.TotalDays - 0.02f) * (1 / 0.02f)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user