public void ClearCache(VegetationCell vegetationCell)
 {
     CompleteCellLoading();
     vegetationCell.ClearCache();
     ClearBillboardCellsCache(vegetationCell.VegetationCellBounds);
     OnClearCacheVegetationCellDelegate?.Invoke(this, vegetationCell);
 }
        public void ClearCache(VegetationCell vegetationCell, int vegetationPackageIndex, int vegetationItemIndex)
        {
            CompleteCellLoading();
            VegetationItemInfoPro vegetationItemInfo =
                VegetationPackageProList[vegetationPackageIndex].VegetationInfoList[vegetationItemIndex];
            bool tree = vegetationItemInfo.VegetationType == VegetationType.Tree ||
                        vegetationItemInfo.VegetationType == VegetationType.LargeObjects;

            vegetationCell.ClearCache(vegetationPackageIndex, vegetationItemIndex, tree);
            ClearBillboardCellsCache(vegetationCell.VegetationCellBounds, vegetationPackageIndex, vegetationItemIndex);
            OnClearCacheVegetationCellVegetatonItemDelegate?.Invoke(this, vegetationCell, vegetationPackageIndex, vegetationItemIndex);
        }
        public void ClearCache(Bounds bounds)
        {
            Rect clearRect = RectExtension.CreateRectFromBounds(bounds);

            CompleteCellLoading();

            //TODO Use quadtree here
            for (int i = LoadedVegetationCellList.Count - 1; i >= 0; i--)
            {
                VegetationCell vegetationCell = LoadedVegetationCellList[i];
                if (!vegetationCell.Rectangle.Overlaps(clearRect))
                {
                    continue;
                }

                vegetationCell.ClearCache();
                LoadedVegetationCellList.RemoveAtSwapBack(i);

                OnClearCacheVegetationCellDelegate?.Invoke(this, vegetationCell);
            }

            ClearBillboardCellsCache(bounds);
        }