コード例 #1
0
 // 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;
     }
 }
コード例 #2
0
 void Update()
 {
     if (DayNightController.isDaytime() && isNight)
     {
         playDaytimeSounds();
         isNight = false;
     }
     else if (DayNightController.isNighttime() && !isNight)
     {
         playNighttimeSounds();
         isNight = true;
     }
 }