예제 #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 CalculateVegetationSystemBounds()
        {
            for (int i = 0; i <= VegetationStudioTerrainObjectList.Count - 1; i++)
            {
                IVegetationStudioTerrain vegetationStudioTerrain =
                    VegetationStudioTerrain.GetIVegetationStudioTerrain(VegetationStudioTerrainObjectList[i]);
                vegetationStudioTerrain?.RefreshTerrainData();
            }

            Bounds newBounds = new Bounds(Vector3.zero, Vector3.zero);

            if (AutomaticBoundsCalculation)
            {
                for (int i = 0; i <= VegetationStudioTerrainObjectList.Count - 1; i++)
                {
                    IVegetationStudioTerrain vegetationStudioTerrain = VegetationStudioTerrain.GetIVegetationStudioTerrain(VegetationStudioTerrainObjectList[i]);
                    if (vegetationStudioTerrain != null)
                    {
                        if (i == 0)
                        {
                            newBounds = vegetationStudioTerrain.TerrainBounds;
                        }
                        else
                        {
                            newBounds.Encapsulate(vegetationStudioTerrain.TerrainBounds);
                        }
                    }
                }
            }
            VegetationSystemBounds = newBounds;
            SetupVegetationSystem();
        }
예제 #3
0
 void RefreshVegetationStudioTerrains()
 {
     VerifyVegetationStudioTerrains();
     VegetationStudioTerrainList.Clear();
     for (int i = 0; i <= VegetationStudioTerrainObjectList.Count - 1; i++)
     {
         IVegetationStudioTerrain vegetationStudioTerrain = VegetationStudioTerrain.GetIVegetationStudioTerrain(VegetationStudioTerrainObjectList[i]);
         if (vegetationStudioTerrain != null)
         {
             VegetationStudioTerrainList.Add(vegetationStudioTerrain);
         }
     }
 }
예제 #4
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();
        }
예제 #5
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();
        }