public void tellLighting(CSteamID steamID, uint serverTime, uint newCycle, uint newOffset, byte moon, byte wind, byte rain, byte snow)
 {
     if (base.channel.checkServer(steamID))
     {
         Provider.time           = serverTime;
         LightingManager._cycle  = newCycle;
         LightingManager._offset = newOffset;
         this.updateLighting();
         LevelLighting.moon         = moon;
         LightingManager.isCycled   = (LightingManager.day > LevelLighting.bias);
         LightingManager.isFullMoon = (LightingManager.isCycled && LevelLighting.moon == 2);
         if (LightingManager.onDayNightUpdated != null)
         {
             LightingManager.onDayNightUpdated(LightingManager.isDaytime);
         }
         LevelLighting.wind      = (float)wind * 2f;
         LevelLighting.rainyness = (ELightingRain)rain;
         LevelLighting.snowyness = (ELightingSnow)snow;
         if (LightingManager.onRainUpdated != null)
         {
             LightingManager.onRainUpdated(LevelLighting.rainyness);
         }
         if (LightingManager.onSnowUpdated != null)
         {
             LightingManager.onSnowUpdated(LevelLighting.snowyness);
         }
         Level.isLoadingLighting = false;
     }
 }
Example #2
0
 private void onLevelLoaded(int level)
 {
     if (level > Level.SETUP)
     {
         LightingManager.onMoonUpdated = null;
         LightingManager.lastRain      = Time.realtimeSinceStartup;
         LightingManager.lastSnow      = Time.realtimeSinceStartup;
         if (Level.info != null && Level.info.type != ELevelType.SURVIVAL)
         {
             LightingManager._cycle  = 3600u;
             LightingManager._offset = 0u;
             if (Level.info.type == ELevelType.HORDE)
             {
                 LightingManager._time       = (uint)((LevelLighting.bias + (1f - LevelLighting.bias) / 2f) * LightingManager.cycle);
                 LightingManager._isFullMoon = true;
             }
             else if (Level.info.type == ELevelType.ARENA)
             {
                 LightingManager._time       = (uint)(LevelLighting.transition * LightingManager.cycle);
                 LightingManager._isFullMoon = false;
             }
             LightingManager.windDelay = (float)Random.Range(45, 75);
             LevelLighting.wind        = (float)Random.Range(0, 360);
             LevelLighting.rainyness   = ELightingRain.NONE;
             LevelLighting.snowyness   = ELightingSnow.NONE;
             Level.isLoadingLighting   = false;
             if (!Dedicator.isDedicated)
             {
                 LevelLighting.time = LightingManager.day;
                 LevelLighting.moon = 2;
             }
             return;
         }
         LightingManager._cycle      = 3600u;
         LightingManager._time       = 0u;
         LightingManager._offset     = 0u;
         LightingManager._isFullMoon = false;
         LightingManager.isCycled    = false;
         if (LightingManager.onDayNightUpdated != null)
         {
             LightingManager.onDayNightUpdated(true);
         }
         LightingManager.windDelay = (float)Random.Range(45, 75);
         LevelLighting.wind        = (float)Random.Range(0, 360);
         if (Provider.isServer)
         {
             LightingManager.load();
             this.updateLighting();
             Level.isLoadingLighting = false;
         }
     }
 }
 // Token: 0x060028BB RID: 10427 RVA: 0x000F7308 File Offset: 0x000F5708
 private void updateLighting()
 {
     LightingManager._time = (Provider.time - LightingManager.offset) % LightingManager.cycle;
     if (Provider.isServer && Time.time - LightingManager.lastWind > LightingManager.windDelay)
     {
         LightingManager.windDelay = (float)UnityEngine.Random.Range(45, 75);
         LightingManager.lastWind  = Time.time;
         LevelLighting.wind        = (float)UnityEngine.Random.Range(0, 360);
         LightingManager.manager.channel.send("tellLightingWind", ESteamCall.OTHERS, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[]
         {
             MeasurementTool.angleToByte(LevelLighting.wind)
         });
     }
     if (LightingManager.day > LevelLighting.bias)
     {
         if (!LightingManager.isCycled)
         {
             LightingManager.isCycled = true;
             if (LevelLighting.moon < LevelLighting.MOON_CYCLES - 1)
             {
                 LevelLighting.moon        += 1;
                 LightingManager.isFullMoon = (LevelLighting.moon == 2);
             }
             else
             {
                 LevelLighting.moon         = 0;
                 LightingManager.isFullMoon = false;
             }
             if (LightingManager.onDayNightUpdated != null)
             {
                 LightingManager.onDayNightUpdated(false);
             }
         }
     }
     else if (LightingManager.isCycled)
     {
         LightingManager.isCycled   = false;
         LightingManager.isFullMoon = false;
         if (LightingManager.onDayNightUpdated != null)
         {
             LightingManager.onDayNightUpdated(true);
         }
     }
     if (!Dedicator.isDedicated)
     {
         LevelLighting.time = LightingManager.day;
     }
 }