Пример #1
0
 // Token: 0x06000CC9 RID: 3273 RVA: 0x0005E3D4 File Offset: 0x0005C7D4
 protected void Update()
 {
     if (MainCamera.instance == null)
     {
         return;
     }
     FoliageSystem.activeTiles.Clear();
     if (FoliageSettings.enabled && FoliageSystem.foliageVisibilityGroup.isVisible)
     {
         FoliageSystem.mainCameraFrustumPlanes = GeometryUtility.CalculateFrustumPlanes(MainCamera.instance);
         FoliageSystem.drawTiles(MainCamera.instance.transform.position, FoliageSettings.drawDistance, null, FoliageSystem.mainCameraFrustumPlanes);
         if (FoliageSettings.drawFocus && FoliageSystem.isFocused && FoliageSystem.focusCamera != null)
         {
             if (MainCamera.instance == FoliageSystem.focusCamera)
             {
                 FoliageSystem.focusCameraFrustumPlanes = FoliageSystem.mainCameraFrustumPlanes;
             }
             else
             {
                 FoliageSystem.focusCameraFrustumPlanes = GeometryUtility.CalculateFrustumPlanes(FoliageSystem.focusCamera);
             }
             FoliageSystem.drawTiles(FoliageSystem.focusPosition, FoliageSettings.drawFocusDistance, FoliageSystem.focusCamera, FoliageSystem.focusCameraFrustumPlanes);
         }
     }
     foreach (KeyValuePair <FoliageCoord, FoliageTile> keyValuePair in FoliageSystem.prevTiles)
     {
         if (!FoliageSystem.activeTiles.ContainsKey(keyValuePair.Key))
         {
             if (keyValuePair.Value != null && keyValuePair.Value.hasInstances)
             {
                 if (keyValuePair.Value.canSafelyClear)
                 {
                     keyValuePair.Value.clearInstances();
                 }
             }
         }
     }
     FoliageSystem.prevTiles.Clear();
     foreach (KeyValuePair <FoliageCoord, FoliageTile> keyValuePair2 in FoliageSystem.activeTiles)
     {
         FoliageSystem.prevTiles.Add(keyValuePair2.Key, keyValuePair2.Value);
     }
     if (FoliageSystem.bakeQueue.Count > 0)
     {
         KeyValuePair <FoliageTile, List <IFoliageSurface> > keyValuePair3 = FoliageSystem.bakeQueue.Dequeue();
         FoliageSystem.bake(keyValuePair3.Key, keyValuePair3.Value);
         if (FoliageSystem.bakeQueue.Count == 0)
         {
             FoliageSystem.bakeEnd();
         }
     }
 }