Skip to main content

DayTimeEffect

A class in Root.Township, Alta.Environmental.Atmosphere.

Plays a particle system only by day or only by night. Client only: on a headless server it destroys itself.

Constructors​

MemberWhat it is
DayTimeEffect()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

2 private and internal fields
MemberWhat it is
private bool isActiveDuringDayTrue to play by day, false to play at night.
private ParticleSystem particleSystemThe particles to play.

Methods​

3 private and internal methods
MemberWhat it is
private void OnDisable()Stops listening for night changes.
private void OnEnable()On headless, destroys the particles and the object; otherwise listens for GameTimeManager.NightChanged and updates now.
private void UpdateEnabled(bool isNight)Plays or stops emitting depending on whether it's night and isActiveDuringDay.