private float DayTimeRatio() { float Result = 0f; if (DayTimeCycle.GetTime().IsDayTime) { Result = DayTimeCycle.GetTime().CurrentTime / 12; } else if (DayTimeCycle.GetTime().IsNightTime) { Result = (DayTimeCycle.GetTime().CurrentTime - 12) / 12; } return(Result); }
void Update() { if (!m_bDayTimeCycleInitialized) { DayTimeCycle.Initialize(); m_bDayTimeCycleInitialized = true; } float dtRatio = DayTimeRatio(); m_ActiveObject.transform.rotation = Quaternion.Lerp(m_StartRotation, m_EndRotation, dtRatio); m_ActiveLight.intensity = Mathf.Lerp(m_StartIntensity, m_EndIntensity, dtRatio); m_ActiveLight.color = Color.Lerp(m_CurrentStartCol, m_CurrentEndCol, dtRatio); // make it 200 second daylight cycles DayTimeCycle.Tick(Time.deltaTime / 200f); }
private void Init() { weather = new Weather(); dayTimeCycle = new DayTimeCycle(); }