Ejemplo n.º 1
0
        //public void OnEnable ()  //VSPro has got to run OnEnable first (objects only)
        public void Start()
        {
            if (package == null)
            {
                return;
            }

            if (!masksApplied)
            {
                VSProOps.SetTextures(system, package, textures, maskGroupNums, terrainRect);
            }
            masksApplied = true;
        }
Ejemplo n.º 2
0
            public void Apply(Terrain terrain)
            {
                //updating system
                VegetationSystemPro copySystem = null;                  //we'll need it to set up tile

                if (copyVS)
                {
                    copySystem = VSProOps.GetCopyVegetationSystem(terrain);
                    if (copySystem == null)
                    {
                        copySystem = VSProOps.CopyVegetationSystem(srcSystem, terrain.transform.parent);
                    }
                    VSProOps.UpdateCopySystem(copySystem, terrain, package, srcSystem);
                }

                else
                {
                    VSProOps.UpdateSourceSystem(srcSystem, terrain);
                }

                //applying
                Texture2D[] textures = WriteTextures(null, colors);
                VSProOps.SetTextures(
                    copyVS ? copySystem : srcSystem,
                    package, textures, maskGroupNums, terrain.GetWorldRect());

                //tile obj (serialization and disable purpose)
                Transform     tileTfm = terrain.transform.parent;
                VSProMapsTile vsTile  = tileTfm.GetComponent <VSProMapsTile>();

                if (vsTile == null)
                {
                    vsTile = tileTfm.gameObject.AddComponent <VSProMapsTile>();
                }
                vsTile.system        = copyVS ? copySystem : srcSystem;
                vsTile.package       = package;
                vsTile.terrainRect   = terrain.GetWorldRect();
                vsTile.textures      = textures;
                vsTile.maskGroupNums = maskGroupNums;
                vsTile.masksApplied  = true;
            }