Exemple #1
0
        public static bool isPointValid(Vector3 point, bool instancedMeshes, bool resources, bool objects)
        {
            bool flag = false;

            if (FoliageVolumeSystem.additiveVolumes.Count > 0)
            {
                for (int i = 0; i < FoliageVolumeSystem.additiveVolumes.Count; i++)
                {
                    FoliageVolume foliageVolume = FoliageVolumeSystem.additiveVolumes[i];
                    if (!instancedMeshes || foliageVolume.instancedMeshes)
                    {
                        if (!resources || foliageVolume.resources)
                        {
                            if (!objects || foliageVolume.objects)
                            {
                                if (FoliageVolumeUtility.isPointInsideVolume(foliageVolume, point))
                                {
                                    flag = true;
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                flag = true;
            }
            if (!flag)
            {
                return(false);
            }
            for (int j = 0; j < FoliageVolumeSystem.subtractiveVolumes.Count; j++)
            {
                FoliageVolume foliageVolume2 = FoliageVolumeSystem.subtractiveVolumes[j];
                if (!instancedMeshes || foliageVolume2.instancedMeshes)
                {
                    if (!resources || foliageVolume2.resources)
                    {
                        if (!objects || foliageVolume2.objects)
                        {
                            if (FoliageVolumeUtility.isPointInsideVolume(foliageVolume2, point))
                            {
                                return(false);
                            }
                        }
                    }
                }
            }
            return(true);
        }
Exemple #2
0
 public static bool isTileBakeable(FoliageTile tile)
 {
     if (FoliageVolumeSystem.additiveVolumes.Count > 0)
     {
         Vector3 center = tile.worldBounds.center;
         for (int i = 0; i < FoliageVolumeSystem.additiveVolumes.Count; i++)
         {
             FoliageVolume volume = FoliageVolumeSystem.additiveVolumes[i];
             if (FoliageVolumeUtility.isPointInsideVolume(volume, center))
             {
                 return(true);
             }
         }
         return(false);
     }
     return(true);
 }
        protected override bool isPositionValid(Vector3 position)
        {
            if (!FoliageVolumeUtility.isPointValid(position, false, true, false))
            {
                return(false);
            }
            int num = Physics.OverlapSphereNonAlloc(position, this.obstructionRadius, FoliageResourceInfoAsset.OBSTRUCTION_COLLIDERS, RayMasks.BLOCK_RESOURCE);

            for (int i = 0; i < num; i++)
            {
                ObjectAsset asset = LevelObjects.getAsset(FoliageResourceInfoAsset.OBSTRUCTION_COLLIDERS[i].transform);
                if (asset != null && !asset.isSnowshoe)
                {
                    return(false);
                }
            }
            return(true);
        }
        // Token: 0x06000CB0 RID: 3248 RVA: 0x0005D934 File Offset: 0x0005BD34
        private static Dictionary <FoliageTile, List <IFoliageSurface> > getTileSurfacePairs()
        {
            Dictionary <FoliageTile, List <IFoliageSurface> > dictionary = new Dictionary <FoliageTile, List <IFoliageSurface> >();

            foreach (KeyValuePair <FoliageCoord, FoliageTile> keyValuePair in FoliageSystem.tiles)
            {
                FoliageTile value = keyValuePair.Value;
                if (FoliageVolumeUtility.isTileBakeable(value))
                {
                    dictionary.Add(value, new List <IFoliageSurface>());
                }
            }
            foreach (IFoliageSurface foliageSurface in FoliageSystem.surfaces)
            {
                FoliageBounds foliageSurfaceBounds = foliageSurface.getFoliageSurfaceBounds();
                for (int i = foliageSurfaceBounds.min.x; i <= foliageSurfaceBounds.max.x; i++)
                {
                    for (int j = foliageSurfaceBounds.min.y; j <= foliageSurfaceBounds.max.y; j++)
                    {
                        FoliageCoord tileCoord = new FoliageCoord(i, j);
                        FoliageTile  orAddTile = FoliageSystem.getOrAddTile(tileCoord);
                        if (FoliageVolumeUtility.isTileBakeable(orAddTile))
                        {
                            List <IFoliageSurface> list;
                            if (!dictionary.TryGetValue(orAddTile, out list))
                            {
                                list = new List <IFoliageSurface>();
                                dictionary.Add(orAddTile, list);
                            }
                            list.Add(foliageSurface);
                        }
                    }
                }
            }
            return(dictionary);
        }
Exemple #5
0
 // Token: 0x06000C4C RID: 3148 RVA: 0x0005CCBE File Offset: 0x0005B0BE
 protected override bool isPositionValid(Vector3 position)
 {
     return(FoliageVolumeUtility.isPointValid(position, true, false, false));
 }