예제 #1
0
 // ReSharper disable once UnusedMember.Local
 void OnDisable()
 {
     if (_currentMaskArea != null)
     {
         VegetationStudioManager.RemoveVegetationMask(_currentMaskArea);
         _currentMaskArea.Dispose();
         _currentMaskArea = null;
     }
 }
예제 #2
0
        public override void UpdateVegetationMask()
        {
            if (!enabled || !gameObject.activeSelf)
            {
                return;
            }

            List <Vector3>  worldSpaceNodeList = GetWorldSpaceNodePositions();
            PolygonMaskArea maskArea           = new PolygonMaskArea
            {
                RemoveGrass                = RemoveGrass,
                RemovePlants               = RemovePlants,
                RemoveTrees                = RemoveTrees,
                RemoveObjects              = RemoveObjects,
                RemoveLargeObjects         = RemoveLargeObjects,
                AdditionalGrassWidth       = AdditionalGrassPerimiter,
                AdditionalPlantWidth       = AdditionalPlantPerimiter,
                AdditionalTreeWidth        = AdditionalTreePerimiter,
                AdditionalObjectWidth      = AdditionalObjectPerimiter,
                AdditionalLargeObjectWidth = AdditionalLargeObjectPerimiter,

                AdditionalGrassWidthMax       = AdditionalGrassPerimiterMax,
                AdditionalPlantWidthMax       = AdditionalPlantPerimiterMax,
                AdditionalTreeWidthMax        = AdditionalTreePerimiterMax,
                AdditionalObjectWidthMax      = AdditionalObjectPerimiterMax,
                AdditionalLargeObjectWidthMax = AdditionalLargeObjectPerimiterMax,

                NoiseScaleGrass       = NoiseScaleGrass,
                NoiseScalePlant       = NoiseScalePlant,
                NoiseScaleTree        = NoiseScaleTree,
                NoiseScaleObject      = NoiseScaleObject,
                NoiseScaleLargeObject = NoiseScaleLargeObject
            };

            if (maskArea.AdditionalGrassWidthMax < maskArea.AdditionalGrassWidth)
            {
                maskArea.AdditionalGrassWidthMax = maskArea.AdditionalGrassWidth;
            }

            if (maskArea.AdditionalPlantWidthMax < maskArea.AdditionalPlantWidth)
            {
                maskArea.AdditionalPlantWidthMax = maskArea.AdditionalPlantWidth;
            }

            if (maskArea.AdditionalTreeWidthMax < maskArea.AdditionalTreeWidth)
            {
                maskArea.AdditionalTreeWidthMax = maskArea.AdditionalTreeWidth;
            }

            if (maskArea.AdditionalObjectWidthMax < maskArea.AdditionalObjectWidth)
            {
                maskArea.AdditionalObjectWidthMax = maskArea.AdditionalObjectWidth;
            }

            if (maskArea.AdditionalLargeObjectWidthMax < maskArea.AdditionalLargeObjectWidth)
            {
                maskArea.AdditionalLargeObjectWidthMax = maskArea.AdditionalLargeObjectWidth;
            }


            if (IncludeVegetationType)
            {
                AddVegetationTypes(maskArea);
            }

            maskArea.AddPolygon(worldSpaceNodeList);

            if (_currentMaskArea != null)
            {
                VegetationStudioManager.RemoveVegetationMask(_currentMaskArea);
                _currentMaskArea = null;
            }

            _currentMaskArea = maskArea;
            VegetationStudioManager.AddVegetationMask(maskArea);
        }