Esempio n. 1
0
        public void GetGrass()
        {
            if (!CheckValidUnityTerrain())
            {
                return;
            }
            detailPrototypes.Clear();

            for (int i = 0; i < terrain.terrainData.detailPrototypes.Length; i++)
            {
                DetailPrototype    s = terrain.terrainData.detailPrototypes[i];
                TC_DetailPrototype d = new TC_DetailPrototype();

                d.minHeight        = s.minHeight / grassScaleMulti;
                d.minWidth         = s.minWidth / grassScaleMulti;
                d.maxHeight        = s.maxHeight / grassScaleMulti;
                d.maxWidth         = s.maxWidth / grassScaleMulti;
                d.bendFactor       = s.bendFactor;
                d.dryColor         = s.dryColor;
                d.healthyColor     = s.healthyColor;
                d.noiseSpread      = s.noiseSpread;
                d.usePrototypeMesh = s.usePrototypeMesh;
                d.prototype        = s.prototype;
                d.prototypeTexture = s.prototypeTexture;
                d.renderMode       = s.renderMode;

                detailPrototypes.Add(d);
            }
        }
Esempio n. 2
0
        public void ApplyGrass(TCUnityTerrain sTerrain = null)
        {
            if (!CheckValidUnityTerrain())
            {
                return;
            }
            if (sTerrain == null)
            {
                sTerrain = this;
            }

            CleanGrassPrototypes(sTerrain);

            List <DetailPrototype> detailPrototypesCleaned = new List <DetailPrototype>();
            float multi = sTerrain.grassScaleMulti;

            bool tooManyGrassMessage = false;

            for (int i = 0; i < sTerrain.detailPrototypes.Count; i++)
            {
                if (detailPrototypesCleaned.Count >= TC.grassLimit)
                {
                    tooManyGrassMessage = true; break;
                }

                TC_DetailPrototype s = sTerrain.detailPrototypes[i];
                DetailPrototype    d = new DetailPrototype();

                d.bendFactor   = s.bendFactor;
                d.dryColor     = s.dryColor;
                d.healthyColor = s.healthyColor;

                d.minHeight = s.minHeight * multi;
                d.maxHeight = s.maxHeight * multi;
                d.minWidth  = s.minWidth * multi;
                d.maxWidth  = s.maxWidth * multi;

                d.noiseSpread      = s.noiseSpread;
                d.usePrototypeMesh = s.usePrototypeMesh;
                d.prototype        = s.prototype;
                d.prototypeTexture = s.prototypeTexture;
                d.renderMode       = s.renderMode;
                TC.SetTextureReadWrite(d.prototypeTexture);
                detailPrototypesCleaned.Add(d);
            }

            if (tooManyGrassMessage)
            {
                TC.AddMessage("TC2 supports generating maximum " + TC.grassLimit + " grass textures."); Debug.Log("TC2 supports generating maximum " + TC.grassLimit + " grass textures.");
            }

            terrain.terrainData.detailPrototypes = detailPrototypesCleaned.ToArray();
        }
Esempio n. 3
0
        public void ApplyGrass(TCUnityTerrain sTerrain = null)
        {
            if (!CheckValidUnityTerrain())
            {
                return;
            }
            if (sTerrain == null)
            {
                sTerrain = this;
            }

            CleanGrassPrototypes(sTerrain);

            List <DetailPrototype> DetailPrototypesCleaned = new List <DetailPrototype>();
            float multi = sTerrain.grassScaleMulti;

            for (int i = 0; i < sTerrain.detailPrototypes.Count; i++)
            {
                TC_DetailPrototype s = sTerrain.detailPrototypes[i];
                DetailPrototype    d = new DetailPrototype();

                d.bendFactor   = s.bendFactor;
                d.dryColor     = s.dryColor;
                d.healthyColor = s.healthyColor;

                d.minHeight = s.minHeight * multi;
                d.maxHeight = s.maxHeight * multi;
                d.minWidth  = s.minWidth * multi;
                d.maxWidth  = s.maxWidth * multi;

                d.noiseSpread      = s.noiseSpread;
                d.usePrototypeMesh = s.usePrototypeMesh;
                d.prototype        = s.prototype;
                d.prototypeTexture = s.prototypeTexture;
                d.renderMode       = s.renderMode;
                TC.SetTextureReadWrite(d.prototypeTexture);
                DetailPrototypesCleaned.Add(d);
            }

            terrain.terrainData.detailPrototypes = DetailPrototypesCleaned.ToArray();
        }