Exemple #1
0
        private void SetGrassDetail(int layer, GrassDetail grassDetail, ref GameObject prefab)
        {
            Texture2D tex = LoadTexture(grassDetail.Name);

            if (!useGrassShader)
            {
                DetailPrototypes[layer].prototypeTexture = tex;
            }
            else
            {
                if (!prefab)
                {
                    prefab = UnityEngine.Object.Instantiate(LoadGameObject("GrassDetails"), parent);
                    prefab.SetActive(false);
                }

                GameObject go = prefab;
                go.GetComponent <Renderer>().material.mainTexture = tex;
                DetailPrototypes[layer].prototype = go;
            }
        }
Exemple #2
0
 private static void ScaleGrassDetail(DetailPrototype reference, DetailPrototype prototype, GrassDetail detail)
 {
     prototype.minHeight = reference.minHeight * detail.HeightModifier;
     prototype.maxHeight = reference.maxHeight * detail.HeightModifier;
     prototype.minWidth  = reference.minWidth * detail.WidthModifier;
     prototype.maxWidth  = reference.maxWidth * detail.WidthModifier;
 }