void Start() { if (debug) { Debug.Log(this.name); } currentTime = clock.getCurrentTime(); Date currentDate = clock.getCurrentDate(); GetInitialSeason(currentDate); Time midnight = clock.GetMidnightTime(); if (currentSeason.GetStartDate().CompareTo(fade_start.GetStartDate()) >= 0 && currentSeason.GetEndDate().CompareTo(fade_end.GetEndDate()) < 0) { if (currentDate.Equals(fade_start.GetStartDate())) { if (midnight.SecondsBetween(currentTime) < minutesToFade * 60) { phase = FADING_IN; float opacity = midnight.SecondsBetween(currentTime) * opacityChangePerSecond; if (debug) { Debug.Log("initial phase determined to be: " + phase + " FADING_IN \n" + "Seconds since midnight: " + midnight.SecondsBetween(currentTime) + "opacity per second: " + opacityChangePerSecond + "Opacity set to: " + opacity); } setOpacity(opacity); } else { phase = SHINING; if (debug) { Debug.Log("initial phase determined to be: " + phase + " SHINING \n" + "Opacity set to: " + 1); } setOpacity(1); } } else { phase = SHINING; if (debug) { Debug.Log("initial phase determined to be: " + phase + " SHINING \n" + "Opacity set to: " + 1); } setOpacity(1); } } else if (currentDate.Equals(fade_end.GetStartDate())) { if (midnight.SecondsBetween(currentTime) < minutesToFade * 60) { phase = FADING_OUT; float opacity = 1 - midnight.SecondsBetween(currentTime) * opacityChangePerSecond; if (debug) { Debug.Log("initial phase determined to be: " + phase + " FADING_OUT \n" + "Opacity set to: " + opacity); } setOpacity(opacity); } else { phase = FADED; if (debug) { Debug.Log("initial phase determined to be: " + phase + " FADED \n" + "Opacity set to: " + 0); } setOpacity(0); } } else { phase = FADED; if (debug) { Debug.Log("initial phase determined to be: " + phase + " FADED \n" + "Opacity set to: " + 0); } setOpacity(0); } previousTime = currentTime.Clone(); previousSeason = currentSeason; }