// Update is called once per frame void Update() { if (DayNightController.getDayNightController().isTimeToCloseBuidings() && !shopsClosed) { foreach (Transform child in buildings) { BoxCollider bc = child.GetComponent <BoxCollider>(); if (bc) { bc.enabled = false; } } shopsClosed = true; } else if (DayNightController.isDaytime() && shopsClosed) { foreach (Transform child in buildings) { BoxCollider bc = child.GetComponent <BoxCollider>(); if (bc) { bc.enabled = true; } } shopsClosed = false; } }
void Update() { if (DayNightController.isDaytime() && isNight) { playDaytimeSounds(); isNight = false; } else if (DayNightController.isNighttime() && !isNight) { playNighttimeSounds(); isNight = true; } }