Esempio n. 1
0
        private static void AddBiomeMaskToVegetationSystem(VegetationSystemPro vegetationSystem, PolygonBiomeMask maskArea)
        {
            int biomeSortOrder = vegetationSystem.GetBiomeSortOrder(maskArea.BiomeType);

            maskArea.BiomeSortOrder = biomeSortOrder;

            Rect maskRect = RectExtension.CreateRectFromBounds(maskArea.MaskBounds);

            if (vegetationSystem.VegetationCellQuadTree != null && vegetationSystem.BillboardCellQuadTree != null)
            {
                List <VegetationCell> selectedCellList = new List <VegetationCell>();
                vegetationSystem.VegetationCellQuadTree.Query(maskRect, selectedCellList);
                for (int i = 0; i <= selectedCellList.Count - 1; i++)
                {
                    selectedCellList[i].AddBiomeMask(maskArea);
                }

                List <BillboardCell> selectedBillboardCellList = new List <BillboardCell>();
                vegetationSystem.BillboardCellQuadTree.Query(maskRect, selectedBillboardCellList);
                for (int i = 0; i <= selectedBillboardCellList.Count - 1; i++)
                {
                    selectedBillboardCellList[i].ClearCache();
                }
            }
        }