Пример #1
0
        public void AddTerrain(GameObject go)
        {
            //TODO only add terrains that overlap area if automatic calculation is disabled
            IVegetationStudioTerrain vegetationStudioTerrain = VegetationStudioTerrain.GetIVegetationStudioTerrain(go);

            if (vegetationStudioTerrain != null)
            {
                if (!VegetationStudioTerrainObjectList.Contains(go))
                {
                    VegetationStudioTerrainObjectList.Add(go);
                }

                RefreshVegetationStudioTerrains();

                if (AutomaticBoundsCalculation)
                {
                    CalculateVegetationSystemBounds();
                }
                else
                {
                    RefreshTerrainArea(vegetationStudioTerrain.TerrainBounds);
                }
            }

            VerifyVegetationStudioTerrains();
        }
Пример #2
0
 public void VerifyVegetationStudioTerrains()
 {
     while (VegetationStudioTerrainObjectList.Contains(null))
     {
         VegetationStudioTerrainObjectList.Remove(null);
     }
 }
Пример #3
0
        public void AddTerrains(List <GameObject> terrainList)
        {
            Bounds combinedBounds = new Bounds();

            for (int i = 0; i <= terrainList.Count - 1; i++)
            {
                IVegetationStudioTerrain vegetationStudioTerrain = VegetationStudioTerrain.GetIVegetationStudioTerrain(terrainList[i]);
                if (vegetationStudioTerrain != null)
                {
                    if (!VegetationStudioTerrainObjectList.Contains(terrainList[i]))
                    {
                        VegetationStudioTerrainObjectList.Add(terrainList[i]);
                    }
                }

                if (i == 0)
                {
                    if (vegetationStudioTerrain != null)
                    {
                        combinedBounds = vegetationStudioTerrain.TerrainBounds;
                    }
                }
                else
                {
                    if (vegetationStudioTerrain != null)
                    {
                        combinedBounds.Encapsulate(vegetationStudioTerrain.TerrainBounds);
                    }
                }
            }

            RefreshVegetationStudioTerrains();

            if (AutomaticBoundsCalculation)
            {
                CalculateVegetationSystemBounds();
            }
            else
            {
                RefreshTerrainArea(combinedBounds);
            }

            VerifyVegetationStudioTerrains();
        }
Пример #4
0
        public void RemoveTerrain(GameObject go)
        {
            if (VegetationStudioTerrainObjectList.Contains(go))
            {
                VegetationStudioTerrainObjectList.Remove(go);
            }
            RefreshVegetationStudioTerrains();

            IVegetationStudioTerrain vegetationStudioTerrain = VegetationStudioTerrain.GetIVegetationStudioTerrain(go);

            if (AutomaticBoundsCalculation)
            {
                CalculateVegetationSystemBounds();
            }
            else
            {
                if (vegetationStudioTerrain != null)
                {
                    RefreshTerrainArea(vegetationStudioTerrain.TerrainBounds);
                }
            }

            VerifyVegetationStudioTerrains();
        }